sphinx-doc / sphinx-doc/sphinx
Allow non-RST parsers to substitute the Locale transform
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8k
- Forks
- 2.6k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
https://github.com/sphinx-doc/sphinx/commit/79650f5827e146afe3ff50485f8a4bd6755f895d (#4938) added code that adds a line of hyphens under (for example) an admonition's title's text.
However, a line of hyphens is an RST-specific syntax for a heading. It does not indicate a heading in all parsers.
In Markdown, for example, a line of hyphens is a second-level heading https://spec.commonmark.org/0.29/#setext-headings. This can cause the heading level to jump from 0 to 2.
To Reproduce
I can create a test scenario, but the bug should be clear from reading the code, with the above context.
Expected behavior
For Markdown, we can just change the hyphen to an equals sign, which Markdown will interpret as a first-level heading.
For other parsers, I suppose there would need to be hooks for those parsers to convert the string to a heading.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the Locale transform introduced in commit 79650f5827e146afe3ff50485f8a4bd6755f895d (#4938), focusing on where the hyphen line is added for parser output. Compare that behavior with Markdown setext headings and determine how non-RST parsers can provide their own heading representation. Done means Markdown no longer causes the heading level to jump and other parsers have an appropriate extension point.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- markdown, python
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100