-
Is there an easy way to customize how section numbering is rendered in the documents? In a certain type of documents, I'd like for the level 3 headings to be rendered as "Article X" followed by a linebreak and then the actual section title (X being the counter). In the sidebar it would be ideal to keep the default rendering, though. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
This isn't super straightforward right now but it's likely possible if you are willing to do some hacking. If you are only targeting HTML you could use CSS counters (https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Counter_Styles/Using_CSS_counters) Another approach would be to use a pandoc filter (https://quarto.org/docs/authoring/filters.html). Note that you can arrange for your filter to run before or after quarto (where quarto will actually be doing the numbering). A key thing to know is that if you write a function to intercept headers you can actually return a list of elements from the filter (so the Header is e.g. replaced with Header,Paragraph) |
Beta Was this translation helpful? Give feedback.
-
Again, thank you very much for the quick reply and example code. |
Beta Was this translation helpful? Give feedback.
This isn't super straightforward right now but it's likely possible if you are willing to do some hacking. If you are only targeting HTML you could use CSS counters (https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Counter_Styles/Using_CSS_counters)
Another approach would be to use a pandoc filter (https://quarto.org/docs/authoring/filters.html). Note that you can arrange for your filter to run before or after quarto (where quarto will actually be doing the numbering). A key thing to know is that if you write a function to intercept headers you can actually return a list of elements from the filter (so the Header is e.g. replaced with Header,Paragraph)