You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when rendering Comark in a framework (Vue, React, Svelte), every call to parse() produces an entirely new AST. framework renderers see all-new object references and re-render the entire document tree, even if only a single character changed in one paragraph
This is costly for:
Streaming/AI chat: tokens arrive rapidly but only the last node is actively changing
Live editors: users edit one section while the rest is static
Expensive plugins: syntax highlighting and math rendering run on every node, every time
Proposal
add automatic node-level diffing to createParse() when the returned parser is called multiple times, it compares the new AST against the previous result and preserves === object references for structurally unchanged nodes
framework renderers can then skip re-rendering nodes whose reference didn't change with zero API changes for consumers. here's a video of react example with react-scan (look at the AST section)
Description
when rendering Comark in a framework (Vue, React, Svelte), every call to
parse()produces an entirely new AST. framework renderers see all-new object references and re-render the entire document tree, even if only a single character changed in one paragraphThis is costly for:
Proposal
add automatic node-level diffing to
createParse()when the returned parser is called multiple times, it compares the new AST against the previous result and preserves === object references for structurally unchanged nodesframework renderers can then skip re-rendering nodes whose reference didn't change with zero API changes for consumers. here's a video of react example with react-scan (look at the AST section)
Before
Screen.Recording.2026-04-16.at.8.50.44.PM.mov
After
Screen.Recording.2026-04-16.at.8.57.31.PM.mov