feat: Add LaTeX and markdown extensions - #9
Open
Fuyeors wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extend the existing LaTeX parser work with five Interactify-compatible Markdown extensions:
#[smiles = SMILES_CODE].extensionsPluginso the default FFM parser performs one post-parse extension pass.The existing
latexPluginremains available independently.createFuyeorMarkdownParser()enables LaTeX and the five new extensions by default, while individual plugins remain publicly exportable for opt-in parser configurations.Rendering contract
The implementation follows the existing Interactify asynchronous processor contract:
<img class="emoji" draggable="false" alt="..." src="..."/><div class="language-mermaid">...</div><div class="language-abc">...</div><div class="language-smiles smiles-block" data-smiles="..."></div>per non-empty line<span class="language-smiles smiles-inline" data-smiles="..."></span>pre.hljs.language-${lang}[data-language="${lang}"]All user-controlled content inserted into HTML attributes or text placeholders is escaped.
Validation
git diff --checkPerformance
Five-run local benchmarks with identical Node/Vitest settings showed that plain text without extension markers changed from a median of
2.185 msto2.204 msper iteration (+0.9%) after the lazy single-pass optimization. New extension paths are measured separately because the baseline parser emitted ordinary text/code rather than the requested structured placeholders. Temporary benchmark files were not included in the commit.Package size
Compared with the existing LaTeX branch using
npm pack, the tarball increased from36,278 Bto40,154 B(+3,876 B,+10.7%), while unpacked size increased from212,359 Bto226,779 B(+14,420 B,+6.8%). The increase is source-only and includes the five extension modules, AST traversal helper, and regression tests; no runtime dependency was added.