perf(reflow): merge emphasis and code span extraction into a single cmark pass#732
Open
chandlerc wants to merge 3 commits into
Open
Conversation
…ode spans Update myst_role_len_at to verify its trailing inline code span using a fast binary search check on the pre-extracted code spans list instead of manually searching for backtick delimiters. Assisted-by: Antigravity with Gemini
…xt elements Update fallback paths inside parse_markdown_elements_inner to slice using char::len_utf8() instead of hardcoded 1-byte indices. This prevents thread panics when the parser falls back on multi-byte (CJK or emoji) character boundaries. Also merge contiguous Element::Text elements together before returning from the parser to clean up the output slice. Assisted-by: Antigravity with Gemini
…mark pass Update parse_markdown_elements_inner to extract both emphasis spans and code spans in a single shared pulldown-cmark parser run. This reduces the number of separate markdown parsing passes per paragraph from three to two, avoiding redundant tokenization overhead. The link extraction pass must remain separate due to broken-link resolution shifting delimiter pairings in corner cases. A standalone extract_code_spans is retained only for the mask calculation utility. Assisted-by: Antigravity with Gemini
Contributor
Author
|
BTW, let me know if you'd rather I handle a stack of changes in some other way -- using the last commit has worked for me in some other projects, but happy to adopt whatever workflow works for you. |
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.
Update parse_markdown_elements_inner to extract both emphasis spans and
code spans in a single shared pulldown-cmark parser run.
This reduces the number of separate markdown parsing passes per paragraph from
three to two, avoiding redundant tokenization overhead. The link extraction pass
must remain separate due to broken-link resolution shifting delimiter pairings in
corner cases. A standalone extract_code_spans is retained only for the mask
calculation utility.
Note that this is based on #731 and #730 -- only the last commit is for review here.
Assisted-by: Antigravity with Gemini