Split table cells on a pipe that follows a closing code span backtick - #729
Merged
nicholasserra merged 2 commits intoSep 30, 2026
Merged
Conversation
_split_row did not split on any pipe preceded by a backtick, to keep `|` inside a cell (trentm#399). That also covered a pipe right after the backtick that closes a code span, so a compact row like |`-v`|verbose| put "verbose" into the first cell. Only keep the pipe when the backtick before it opens a code span.
Collaborator
|
LGTM thanks! |
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.
With
extras=["tables"], a pipe directly after a code span is not treated as a cell border, so a compact row loses a cell:gives
<td><code>-v</code>|verbose</td><td></td>instead of<td><code>-v</code></td><td>verbose</td>.Tables._split_rowsplits on(?<![\\])|. The backtick in the lookbehind was added for #399 to keep ``|` `` in one cell, but it also skips a pipe right after the backtick that closes a code span. This keeps the pipe only when the backtick before it opens a span (an odd number of backticks so far in the row), and otherwise splits as before.Only that case changes:
`|`,`a|b`, a row with unmatched backticks, and escaped pipes render the same as on master (I compared these before and after). The new tm-casetables_code_span_adjacent_pipefails on master;make testonehas no other failures apart from the 7 pygments>=2.21 cases that fail the same way on master in my environment, andmake testredospasses.Written with AI assistance (Claude); I have reviewed the change.