Conversation
The texmath block rules matched their regex against the rest of the source, so a block opened inside a blockquote could match a closing delimiter placed after it. The rule then pushed a token and returned True without advancing `state.line`, and the block tokenizer looped forever. The closing line is now searched within the current block only; otherwise the rule does not match, as in `amsmath` (executablebooks#117). Fixes executablebooks#156 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UQqBAyRu8anrLPy829yMmV
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.
Fixes #156.
make_block_funcintexmath/index.pymatched each block rule's regex against the rest of the source, so a block opened inside a blockquote could match a closing delimiter placed after it. The rule then pushed a token and returnedTruewithout advancingstate.line, and the block tokenizer looped forever:Change
[begLine, endLine). If the match ends outside the current block, the rule returnsFalsebefore pushing any token. It does not auto-close, which is howamsmathbehaves since Infinite loop inamsmathextension for a simple input聽#117. The example above now renders$$ a=1as a paragraph in the blockquote, followed by$$as a paragraph.Tests
texmath_dollar.mdandtexmath_bracket.md: blockquote, and blockquote inside a list item.test_block_closed_outside_blockquote, one case per delimiter set (brackets,dollars,kramdown,gitlab,julia). Without the fix these tests hit the pytest timeout.ruff check,ruff format --checkandmypy mdit_py_plugins.The
CHANGELOG.mdentry opens anUnreleasedsection, like #148 does, so the two PRs will conflict trivially there.馃 Generated with Claude Code
https://claude.ai/code/session_01UQqBAyRu8anrLPy829yMmV