-
Notifications
You must be signed in to change notification settings - Fork 331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments in Code cells are taken as section and increment numbering #11835
Comments
This bug almost certainly from the code that detects the highest level of headings. I bet we're using regexps there. Another point for the "AST everywhere" project I keep talking about... |
It does not happen for HTML it seems, so I was curious. This is indeed LaTeX and Typst specific quarto-cli/src/format/pdf/format-pdf.ts Lines 256 to 273 in 52a6a5b
quarto-cli/src/format/typst/format-typst.ts Lines 69 to 78 in 52a6a5b
So this is a processing specific to Quarto and we do indeed use regex in both place to search for headings. quarto-cli/src/format/typst/format-typst.ts Lines 70 to 71 in 52a6a5b
quarto-cli/src/format/pdf/format-pdf.ts Lines 256 to 257 in 52a6a5b
On way to fix this would be a Pandoc call with a Lua filter giving us information if any H1. In any case, this is another call to |
Yes, sorry I only implied it. |
The truly correct fix here would be for us to operate on the AST (either via Pandoc or some other parser). A slightly better way to this would be to use the MappedString infrastructure and breakQuartoMd, but I think it will require adding a few functions to the mapped-text.ts API, and I don't know if that's worth the trouble. But, you could:
Edit: it's even easier than that, because |
:sadtrombone: We can't really solve it with breakQuartoMd, because formatExtras operates on the post-engine markdown, which doesn't have executable code blocks, and the bug can happen with non-executable code blocks as well. Here's a simpler repro:
A second call to |
#11841 is exactly what I had in mind by using Pandoc ! Thanks for the quick fix! |
Bug description
A comment in a code cell (qmd/ipynb)
# a comment
lead to the wrong overall header level to be used in the document for Typst and LaTeX formats.Note that the behaviour is observed for all engines.
Steps to reproduce
Render the following document into Typst or LaTeX PDF.
Expected behavior
Without having to double the comment symbol or use
shift-heading-level-by: -1
.Your environment
Quarto check output
The text was updated successfully, but these errors were encountered: