markup icon indicating copy to clipboard operation
markup copied to clipboard

Specifying heading levels in rST

Open orome opened this issue 8 years ago • 3 comments

In a .md file I'm able to specify heading levels that are respected in they way they are displayed on GitHub, but my .rst files are not: the "highest" level heading is treated as a level 1 heading,

For example,

## Heading

in a .md will be treated as a second-level heading, while its equivalent (e.g as generated by pandoc),

Heading
-------

is treated as a first-level heading.

Is there a way to overcome this? Can I fix the heading level in rST, or at least have GitHub interpreted it that way?

orome avatar Nov 22 '15 14:11 orome

Can you link to an example showing this? Thank you!

kivikakk avatar Mar 23 '17 00:03 kivikakk

ReStructuredText heading levels are actually determined by the order (that underlining character) appears in the document: and not just by what character appears under the header. In particular

Header 2
--------

Will be only treated as a second-level heading if there is a first-level heading before it in the ReStructuredText document like a

Header 1
========

appearing before it in the document. It would also be legitimate ReStructuredText to flip the - and = or use other non-alphanumeric characters like -,`,:,',",~,^,_,*,+,#,<,> etc. as long as the relative order of appearance stays the same like

Header 1
~~~~~~~~

Header 2
<<<<<<<<

Header 3
========

Header 4
--------

Are you sure you actually have a first-level header before that second-level header? Is there a semantic meaning of a second-level header without a first-level header (i.e. aren't your second-level headers then in fact first-level headers)? If you just want your headers to appear differently (a little smaller?) then that is a job for the CSS style sheet (which how Github does or does not provide users access to is a completely separate issue).

trevorld avatar Apr 25 '18 22:04 trevorld

somewhat related: https://github.com/github/markup/issues/1446

timotheecour avatar Feb 18 '21 20:02 timotheecour