fix(render): don't markdown-escape values rendered inside code spans#1
Merged
Conversation
`renderRow` wraps the tag and declaration name in `` `...` `` code spans before passing them through `mdTableEscape`. Markdown doesn't interpret `_`, `*`, `[`, etc. inside a code span, so the backslash escapes leak through verbatim: a decl like `Subgroup.card_subgroup_dvd_card` rendered as `Subgroup.card\_subgroup\_dvd\_card`. Add `mdCodeCellEscape` covering only what can break out of the span or the surrounding table cell (backticks, `|`, newlines) and use it for the tag and decl cells. Free-text cells (title, description, comment) still go through `mdTableEscape`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
This PR fixes a rendering bug in
Crossrefs.Render.renderRow: tag and declaration cells are wrapped in`...`code spans but then passed throughmdTableEscape, which backslash-escapes_,*,[,],(,),#. Markdown does not interpret any of these inside a code span, so the escapes leak through as literal backslashes. A decl likeSubgroup.card_subgroup_dvd_cardrendered asSubgroup.card\_subgroup\_dvd\_card.Add a separate
mdCodeCellEscapethat only handles characters which can break out of the code span or the surrounding table cell (backticks →ˋlook-alike,|, newlines) and use it for the tag and decl cells. Free-text cells (title, description, comment) still go through the fullmdTableEscape.Caught by the test render against leanprover-community/mathlib4#39909 (comment).
🤖 Prepared with Claude Code