Why do Level 2 headings become Level 1 in Typst? #14833
Replies: 2 comments 2 replies
|
This indeed seems intentional. Quarto does it, not Pandoc. When a document has no level 1 heading, Quarto adds
The test is a Pandoc AST walk, not a regular expression. Quarto runs a small Lua filter over the markdown and asks one question: is there a
The answer decides the shift. For Typst the only other condition is that you did not set
This explains both of your files. The equivalent code for PDF and LaTeX carries the extra conditions, which is why
Two details are worth knowing. The shift is a fixed Pandoc applies How to turn the heading shift off specificaly for Typst Set format:
typst:
shift-heading-level-by: 0
|
For the context of the design, I think we do this by design because this is better practice to have H1 header in all documents structure. This is valid of HTML but also for PDF And this is even more ture with Accessibility validation. With verapdf on a PDF produce using typst with Pandoc <errorMessage>Heading level 1 is skipped in a descending sequence of header levels</errorMessage>This is ISO 14289-1:2014 claude 7.4.2
So in Quarto we do enforce by default this H1 as results of structure even is For the technical implementation and how to opt out this is shared ☝️ |
Uh oh!
There was an error while loading. Please reload this page.
Description
This Quarto file
produces the following Typst code:
But when I remove the Level 1 heading to get this Quarto file
I will have the
##line as Level 1 heading in Typst:Why is this happening? This looks to be an intentional behavior. But I don't know why this is happening and I couldn't find a reference to that behavior in the docs.
All reactions