Repository navigation
fix(id): hoist delimiter-mark edge spaces touched by word chars on save (#1418) - #1510
Conversation
…ve (#1418) A delimiter-mark span (em/strong/strikethrough) whose text starts or ends with a space saved with the space inside the delimiters, which comrak renders as an   entity (a* b*). When a word character touches the span on that side, that form fails CommonMark flanking rules on reparse and the mark is destroyed, leaving literal delimiters in the text. Add an AST post-pass in prosemirror_to_markdown (after #968 chain merging, so only true span edges are considered): for each delimiter wrapper, an edge space with a word character immediately outside it on that side is moved to a plain text node just outside the wrapper (still inside any outer link). The space becomes unmarked, which renders identically, and the saved form reparses with the mark intact. Edges a word character does not touch keep the   form, which round-trips PM-identical as before. Tests: web::markdown matrix for em/strong/strikethrough/em+strong x leading/trailing edge x word neighbour, in paragraphs and headings, plus controls (both-edges padded, space neighbour, paragraph boundary). 89 web::markdown tests pass on the laptop (cargo test --offline --features web --lib web::markdown).
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 22 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
🤖 Agent note · parked
|
Fixes #1418.
Problem
A delimiter-mark span (em/strong/strikethrough) whose text starts or ends with a space saved with the space inside the delimiters; comrak renders it as an
 entity (a* b*). When a word character touches the span on that side, that form fails CommonMark flanking rules on reparse — the mark is destroyed and literal delimiters are left in the text (and escaped on the next save).Fix
AST post-pass in
prosemirror_to_markdown(hoist_delimiter_edge_spacesinpkgs/id/src/web/markdown.rs), running after #968 chain merging so only true span edges are considered — an edge space shared with a neighbouring run of the same span is interior there, not an edge. For each delimiter wrapper, an edge space with a word character immediately outside it on that side is moved to a plain text node just outside the wrapper (still inside any outer link wrapper). The space becomes unmarked, which renders identically, and the saved form reparses with the mark intact.Edges a word character does not touch (paragraph boundary, space/punctuation neighbours, spans padded on both edges) keep the
 form, which round-trips PM-identical as before. Link and code marks are untouched (their syntax tolerates edge spaces). Marks wrapping images / spanning html_inline (#1407/#1412) are different mechanisms and unchanged.Tests
New regression tests in
pkgs/id/src/web/markdown.rs:a+ em(b) +c)Verified on the laptop worktree:
cargo test --offline --features web --lib web::markdown— 89 passed, 0 failed (includes the existing #953/#968/#981 mark tests). Note: a fresh worktree needs apkgs/id/web/distpresent for the RustEmbed derive to compile locally; a placeholder dist was used locally only (gitignored, not in this PR) — CI builds the real assets.Queue task 1485 (repo-health-code-pilot).
Need help on this PR? Tag
@codesmith-botwith what you need.