Skip to content

feat: paste images, LaTeX math, and enhanced markdown (hr, blockquote…#42

Open
vanductan-NLT wants to merge 1 commit into
antonmedv:masterfrom
vanductan-NLT:claude/wizardly-curie-epxhP
Open

feat: paste images, LaTeX math, and enhanced markdown (hr, blockquote…#42
vanductan-NLT wants to merge 1 commit into
antonmedv:masterfrom
vanductan-NLT:claude/wizardly-curie-epxhP

Conversation

@vanductan-NLT
Copy link
Copy Markdown

…, lists)

  • Switch contenteditable from plaintext-only to full (needed for paste control)
  • Paste images: clipboard images → data URL → PUA char placeholder → rendered
  • Paste math: $$...$$ and $...$ replaced with PUA chars at paste time, rendered via KaTeX (loaded from CDN) in non-editable spans; formulas stored in localStorage
  • parseMarkdown: add --- (hr), > blockquote, - /* list item patterns
  • getEditorText(): TreeWalker that skips .math-rendered to avoid KaTeX text polluting editor content reads (used in parseMarkdown, get(), updateTitle())
  • visit() in Editor: skip .math-rendered subtrees for correct cursor positioning
  • get(): uses getEditorText(); garbage-collects unused PUA refs; persists imageStore + mathStore to localStorage['images'] / localStorage['math']
  • load(): restores imageStore + mathStore from localStorage before rendering
  • downloadTXT(): exports getPlainText() which expands PUA → $$formula$$ / [image]

https://claude.ai/code/session_01UNE79Mg1avmCkeynzckCx5

…, lists)

- Switch contenteditable from plaintext-only to full (needed for paste control)
- Paste images: clipboard images → data URL → PUA char placeholder → <img> rendered
- Paste math: $$...$$ and $...$ replaced with PUA chars at paste time, rendered
  via KaTeX (loaded from CDN) in non-editable spans; formulas stored in localStorage
- parseMarkdown: add --- (hr), > blockquote, - /* list item patterns
- getEditorText(): TreeWalker that skips .math-rendered to avoid KaTeX text
  polluting editor content reads (used in parseMarkdown, get(), updateTitle())
- visit() in Editor: skip .math-rendered subtrees for correct cursor positioning
- get(): uses getEditorText(); garbage-collects unused PUA refs; persists
  imageStore + mathStore to localStorage['images'] / localStorage['math']
- load(): restores imageStore + mathStore from localStorage before rendering
- downloadTXT(): exports getPlainText() which expands PUA → $$formula$$ / [image]

https://claude.ai/code/session_01UNE79Mg1avmCkeynzckCx5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants