As you can see in the picture above, hide height to 0pt is not the right way to ignore headings, and the PDF bookmark is different from the outline().
The script is:
The Typst output is what I would expect: you have headings such as = Markdown and == Commonmark which you don’t configure in any way so they end up in the table of contents.
Could you include an image of the output you expect?
@sijo open the pdf with Web browser Firefox (PDF.js library), the outline is broken! I marked a yellow area in picture to compare the two outlines (PDF.js and typ outline()), you could see the differences. @Andrew Thank you for code style addvices, help me a lot!