Skip to content

CI validation: fix(editor) intraword underscore escaping - #2

Open
nvimq wants to merge 1 commit into
mainfrom
fix/markdown-escape-intraword-underscore
Open

nvimq wants to merge 1 commit into
mainfrom
fix/markdown-escape-intraword-underscore

Conversation

@nvimq

@nvimq nvimq commented Sep 22, 2026 •

Copy link
Copy Markdown
Owner
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​79 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​79
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​66 $\color{#cf222e}{\Huge{\mathbf{−}}}$​5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​61

Same-repo PR to run full CI matrix on GitHub runners before the real PR (stablyai#22123).

@tiptap/markdown's escapeMarkdownSyntax backslash-escapes every `_`
character unconditionally when re-serializing an edited block. This
turns any identifier containing underscores (e.g. `user_name_field`)
into `user\_name\_field` on save, which then renders literally with
visible backslashes.

Patch @tiptap/markdown@3.31.3 (via pnpm patch) so an underscore is
only escaped when it is NOT flanked by word characters on both sides,
matching CommonMark's intraword-underscore-is-literal rule. Emphasis-
style underscores (leading/trailing/whitespace-flanked) keep escaping
exactly as before.

Scope: this only fixes underscores. Backslash, backtick, asterisk,
and brackets are unchanged. Tilde is also left unchanged: GFM
strikethrough delimiters in the actual parser (marked) can pair up
across arbitrary distance within a text run based on flanking rules,
not just adjacent `~~`, so a safe per-character fix for tilde isn't
possible without a full delimiter-matching pass - out of scope here.

Fixes stablyai#22014 (partially; see scope note above).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant