Repository navigation
feat: add opt-in ENRMRKD_TEXT_ESCAPED for backslash escapes - #5
Closed
juliusmarminge wants to merge 1 commit into
Closed
juliusmarminge wants to merge 1 commit into
juliusmarminge wants to merge 1 commit into
Conversation
ENRMRKD_FLAG_ESCAPEDTEXT reports a backslash-escaped character in normal text as ENRMRKD_TEXT_ESCAPED, so an application can tell an escape from the literal character. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 27, 2026
Merged
Author
|
Closing in favour of mity#477, which adds the same opt-in upstream ( |
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.
What and why
Add the opt-in
ENRMRKD_FLAG_ESCAPEDTEXTflag. With it, a backslash-escaped character in normal text is reported as the newENRMRKD_TEXT_ESCAPEDtext type instead ofENRMRKD_TEXT_NORMAL. The text is still the character without its backslash, so a renderer that handles both types the same way produces the same output.Today an application cannot tell
\.from.once the text reaches its callback. Enriched Markdown needs that distinction for an opt-inpreserveWindowsPathsflag: CommonMark readsC:\Users\me\.configasC:\Users\me.config, and with the flag the application puts the backslash back when the escape sits inside a drive path. Doing this in the parser wrapper keeps the vendored parser byte-identical to this fork throughscripts/fetch-md4c.sh, as the review on enriched-markdown#1037 asked of parser changes.The consumer PR is software-mansion/enriched-markdown#1105. This one needs to merge first.
Behavior
ENRMRKD_TEXT_NORMALchange type. A backslash before a newline is still a hard break. Code spans, code blocks and raw HTML have no escapes, so they are unaffected. Link destinations and titles are built as attributes and keep their resolved text.md4c-htmlalready renders unknown text types as escaped HTML, so its output is unchanged with the flag on.0x2000000, leaving0x1000000forENRMRKD_FLAG_HTMLBRin feat: add opt-in HTML line break events #3. md2html gets--fescaped-textas-Q, since-Eand-Jare taken.Validation
test/spec-escaped-text.txtruns through the existingscripts/run-tests.pywith--fescaped-text: path-like escapes, ordinary escapes, code spans, link destinations and titles, and backslash hard breaks render exactly as without the flag.C:\Users\me\.t3keeps its backslashes when its flag is on and parses as CommonMark when it is off.Model: Claude Opus 5.5. Harness: Claude Code in T3 Code.