|
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. |
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) |
|
Again, thank you very much for the quick reply and example code. |
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)