sphinx-doc / sphinx-doc/sphinx

improve section headers documentation

Open
#11,087 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type:docs
Dominant language
Python
Stars
8k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

In the official Sphinx reStructuredText Primer it is written that

Section headers (ref) are created by underlining (and optionally overlining) the section title with a punctuation character

so it is optional. I understood that it should not affect anything.

However, in RST specification for sections it is stated:

Underline-only adornment styles are distinct from overline-and-underline styles that use the same character.

It says nothing about the hierarchy though, whether underline-only are higher or lower than underline-and-overline and how they are related to headers with other characters. Probably it is solved by this:

Rather than imposing a fixed number and order of section title adornment styles, the order enforced will be the order as encountered.

I think that to have documentation in two places is misleading (or please state explicitly that one should consult the specification). Or maybe the word "optional" is misleading there. I'm having troubles with section hierarchy in LaTeX and this was one of the catches I stumbled upon - I think this could be improved!

How to Reproduce

can be checked with such index.rst

=====
Title

Subtitle 1


Subtitle 2

Environment Information
Sphinx
Version: 5.3.0, 6.0.0 works same.
Sphinx extensions

No response

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Sphinx reStructuredText Primer sections page and the linked Docutils section specification, then reproduce the supplied index.rst example. Clarify the relationship and hierarchy of underline-only and overline-and-underline adornments, and update the documentation so the guidance is consistent or explicitly points readers to the specification.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.