Repository navigation
feat(core): opt-in preserveWindowsPaths md4c flag (upstream #1105) - #10
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
18f2d8c to
4b18620
Compare
CommonMark reads the \. in C:\Users\me\.config as an escape and drops the separator. With md4cFlags.preserveWindowsPaths, a backslash escape inside a Windows drive path in prose keeps its backslash. Escapes elsewhere, code, link destinations, titles and image alt text are unchanged. Uses ENRMRKD_FLAG_ESCAPEDTEXT from software-mansion-labs/md4c to tell an escape from a literal character. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4b18620 to
29ddd42
Compare
| } | ||
|
|
||
| if (type == ENRMRKD_TEXT_ESCAPED) { | ||
| const bool inImage = std::any_of(impl->nodeStack.begin(), impl->nodeStack.end(), |
There was a problem hiding this comment.
🟡 Medium parser/MD4CParser.cpp:605
With preserveWindowsPaths enabled, each ENRMRKD_TEXT_ESCAPED callback scans the entire nodeStack to check for an image, so deeply nested blockquotes followed by many escapes incur O(depth × escapes) work and can stall synchronous parsing. Track image nesting on node entry and exit instead of searching all ancestors for every escaped character.
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @packages/core/cpp/parser/MD4CParser.cpp around line 605:
With `preserveWindowsPaths` enabled, each `ENRMRKD_TEXT_ESCAPED` callback scans the entire `nodeStack` to check for an image, so deeply nested blockquotes followed by many escapes incur O(depth × escapes) work and can stall synchronous parsing. Track image nesting on node entry and exit instead of searching all ancestors for every escaped character.
The parser keeps `<br>` in a cell as literal text; a line ending only reaches a cell from a decoded ` `, `
` or ` `. Writing it back as `<br>` changed the cell's content on paste, and `\r` still broke the row. Line endings now go back to ` ` and ` `, so a copied cell matches its source. A backslash run right before one is doubled so it stays literal; a lookbehind keeps long runs linear. The iOS test parses real tables. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…oftware-mansion#1144) * fix: copied table cells keep their line breaks as <br> A table cell's serialized markdown joined a line break with a raw newline, which ends the table row, so Copy as Markdown split the row. Write the break as <br> instead, on iOS and Android, keeping escaped backslashes before it. From pingdotgg/t3code#29355. * test: cover line breaks in serialized table cells Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: copy line endings in table cells back as their entities The parser keeps `<br>` in a cell as literal text; a line ending only reaches a cell from a decoded ` `, `
` or ` `. Writing it back as `<br>` changed the cell's content on paste, and `\r` still broke the row. Line endings now go back to ` ` and ` `, so a copied cell matches its source. A backslash run right before one is doubled so it stays literal; a lookbehind keeps long runs linear. The iOS test parses real tables. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor: note the break-node limit of the table cell serializer The cell serializer writes decoded line endings back as entities. A LineBreak node can't reach a cell yet; once <br> parsing lands (software-mansion#1037), it needs <br> instead, so the doc comment says so on both platforms. Also builds the iOS line-ending set once instead of per cell, and drops a test case that repeats the backslash one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: shivam <91240327+shivamhwp@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Gregory Moskaliuk <mosckalyuck@gmail.com> Co-authored-by: Gregory Moskaliuk <gregory.moskaliuk@swmansion.com>
Carries software-mansion/enriched-markdown#1105 (opt-in
md4cFlags.preserveWindowsPaths), which depends on software-mansion-labs/md4c#5.test-core-parser.shandtest-web-bundle.mjspass on this branch.T3 Code consumes the archive packed from 29ddd42 in pingdotgg/t3code#21454. Merge this with it.
Model: Claude Opus 5.5. Harness: Claude Code in T3 Code.