-
-
Notifications
You must be signed in to change notification settings - Fork 53
Fix crash during block math parsing #142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,7 @@ struct MathFirstMarkdownViewRenderer: MarkdownViewRenderer { | |
|
|
||
| var extractor = ParsingRangesExtractor() | ||
| extractor.visit(content.parse(options: ParseOptions().union(.parseBlockDirectives))) | ||
| for range in extractor.parsableRanges(in: rawText) { | ||
| for range in extractor.parsableRanges(in: rawText).reversed() { | ||
| let segment = rawText[range] | ||
| let segmentParser = MathParser(text: segment) | ||
|
Comment on lines
+21
to
23
|
||
| for math in segmentParser.mathRepresentations.reversed() where !math.kind.inline { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change fixes a crash scenario (math blocks + code blocks). Please add a regression test that renders markdown containing both a fenced code block and a display-math block to ensure
MathFirstMarkdownViewRendererno longer crashes when processing multiple parsable segments.