markup
markup copied to clipboard
Specifying heading levels in rST
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?
Can you link to an example showing this? Thank you!
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).
somewhat related: https://github.com/github/markup/issues/1446