fix: conceal padding spaces in multi-backtick code spans per CommonMark spec#635
Merged
Merged
Conversation
…rk spec
CommonMark specifies that when a code span uses multiple backtick
delimiters, a single leading and trailing space is stripped from the
content, provided the content is not entirely whitespace. This is the
standard way to include literal backticks in inline code.
For example, to render Cmd+` as inline code, one writes:
`` Cmd+` ``
The double backticks are delimiters, and the spaces adjacent to them
are padding that should not appear in the rendered output.
Previously, render-markdown.nvim correctly concealed the backtick
delimiters but left the padding spaces visible, resulting in extra
whitespace in the rendered output.
This adds a conceal_padding step to the inline code renderer that
detects multi-backtick code spans and conceals the inner padding spaces,
matching the expected CommonMark rendering.
Reference: https://spec.commonmark.org/0.31.2/#code-spans (examples 349-362)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Owner
|
Thank you! |
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.
CommonMark specifies that when a code span uses multiple backtick delimiters, a single leading and trailing space is stripped from the content, provided the content is not entirely whitespace. This is the standard way to include literal backticks in inline code.
For example, to render Cmd+` as inline code, one writes:
The double backticks are delimiters, and the spaces adjacent to them are padding that should not appear in the rendered output.
Previously, render-markdown.nvim correctly concealed the backtick delimiters but left the padding spaces visible, resulting in extra whitespace in the rendered output.
This adds a conceal_padding step to the inline code renderer that detects multi-backtick code spans and conceals the inner padding spaces, matching the expected CommonMark rendering.
Reference: https://spec.commonmark.org/0.31.2/#code-spans (examples 349-362)