fix(markdown): escape pipes in code spans inside table cells - #110
Merged
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 3 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
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.
A row is split into cells before any inline is parsed, so a pipe is syntax inside a code span too. Plain text, styled text and URLs already escaped it in a cell; code spans did not, because
push_code_spanwas the one emitter that never received the context it was rendering into.Both cell code paths route through it, the inline
coderun and a<pre>block in a cell, so passing the context fixes both.Before, on a two-column table:
The delimiter row declares two columns and the body row emits three, so a GFM renderer drops
bitwise orand tears the code span in half. After:Closes #84
Summary by cubic
Escapes pipes in Markdown code spans inside table cells so they no longer split columns. Previously, a pipe in a cell code span acted as a delimiter; now it renders as |, and an existing | renders as \| to preserve the escape. Code outside tables is unchanged.
InlineContextintopush_code_spanand escape only forInlineContext::TableCell.<pre>code throughpush_code_span; add tests for "a | b" and pre-escaped "a | b".escape.rsasescape_cell_code_span; restore thebacktick_fencedoc comment.Written for commit 85d3606. Summary will update on new commits.