Repository navigation
Preserve escapes and entities in image alt text - #600
Open
Ychris12138 wants to merge 1 commit into
Open
Ychris12138 wants to merge 1 commit into
Ychris12138 wants to merge 1 commit into
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.
Fixes #599.
Image alt text currently drops
text_specialchildren, so formattingloses the backslash andP, and entities/escaped punctuation disappear. Render those tokens using their original markup. Keeping the escape/entity spelling also prevents literal closing brackets, backticks, and angle brackets from becoming Markdown syntax.Adds 14 regressions covering escapes, named/numeric entities, literal delimiters, wrapping, and idempotence. All fail before the fix and pass afterward. This remains useful with older markdown-it-py releases supported by mdformat, independently of the upstream parser fix in executablebooks/markdown-it-py#446.
Validation on Python 3.12: full pytest suite 4296 passed, 5 skipped; Black, isort, mypy for changed Python files, git diff --check, and mdformat --check README.md passed. No network or model API is needed for these tests.
AI-assisted implementation; all reported verification was executed locally.