Skip to content

numpydoc: report short title underlines - #187

Merged
rr- merged 2 commits into
mainfrom
rework/52-underline-rule
Nov 7, 2026
Merged

rr- merged 2 commits into
mainfrom
rework/52-underline-rule

Conversation

@rr-

@rr- rr- commented Nov 7, 2026 •

Copy link
Copy Markdown
Owner

A Numpydoc section title's underline used to be accepted at any length. By default it now needs at least three dashes or equals signs.

NumpydocParser takes two new options:

  • min_underline: int = 3, the shortest underline allowed.
  • exact_underline: bool = False. When true, the underline must be exactly as long as the title.

A declared title whose underline breaks the rule is still read as its section, and the parser reports a new bad-underline problem. try_parse() returns it, and parse() raises it as ParseError. The code is documented with the other problem codes on Problem.

Case diffs: none. Parity against origin/main: 0 of 29184 docstrings differ (case 0, stdlib 0, generated 0). No case or stdlib docstring reports bad-underline.

A section title's underline could be any length. It now needs at least
three dashes or equals signs, or the parser's min_underline. With
exact_underline, it must be as long as the title. A declared title
whose underline breaks the rule is still read as its section, with a
bad-underline problem, which strict parsing raises.
@rr- rr- self-assigned this Nov 7, 2026
@rr-
rr- merged commit f0a23c0 into main Nov 7, 2026
26 checks passed
@rr-
rr- deleted the rework/52-underline-rule branch November 7, 2026 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant