Repository navigation
Conversation
Sphinx renders a fenced code block as plain text without emitting any warning, so the mistake is silent in the built HTML. A backtick is a valid section title adornment character, so a line made only of backticks is only reported when it is not adjacent to a shorter-or-equal line of text. Closes sphinx-contrib#155
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
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.
Fixes #155.
A markdown-style fenced code block is rendered as plain text by Sphinx without any warning, so
the mistake is only visible in the built HTML.
check_triple_backtickscovers the inline form only (its regex requires text between thefences), so a line made of fences is not covered by anything. This adds a
markdown-code-fencechecker for it. Only the opening fence of a block is reported, so a fenced block gives one
error rather than two.
Two things worth a look during review
The checker is
rst_only(the decorator default), so it sees the output ofhide_non_rst_blocks()and never looks inside literal blocks orcode-blockdirectives.Documentation that shows markdown on purpose therefore stays quiet.
A backtick is a valid section title adornment character, so a line of backticks under (or over)
a title is indistinguishable from a fence by shape alone.
_is_section_adornment()handlesthat: a line made only of backticks is left alone when it is adjacent to a line of text no
longer than itself. Without that guard your own
xpass/sections.rstandxpass/this-is-just-a-title.rstfixtures fail.Measured
On
c6d82b7:.rstfiles shipped in the docutils 0.23 and Sphinx 8.1.3 sdists_is_section_adornment()removedThe test is
tests/fixtures/xfail/markdown-code-fence.rst, picked up automatically bygather_xfail(); it fails on an unpatched checkout.ruff checkandruff format --diffat the pinned v0.15.20 are clean on both changed files.AI-assisted (LLM used for drafting); the runs above are mine.