Are Lua filters the canonical way to provide reusable style elements in Typst? #11522
Unanswered
jimjam-slam
asked this question in
Q&A
Replies: 1 comment
-
I can see there's some Pandoc discussion on doing something like this with Typst labels too! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description
When outputting to HTML, I can put a class name on a fenced Pandoc div or span and then attach a stylesheet to consistently style all elements with that classname:
I can also inline those styles on a given block:
If I'm outputting to Typst, I can do the latter on a fenced Pandoc div classed
.block
with inline styles:But the only ways I can find to do the former are:
One shortcoming with the latter is that, as far as I know, if you define a custom selector in raw Typst with a show rule, you can only use that custom selector in raw Typst. Are there any plans to more generally map Pandoc fenced div class names to Typst selectors that may be defined either in the template or in raw Typst?
(I ask this knowing it's likely a significant engineering effort and there may be other blockers or reasons not to do it — just wondering whether I should assume I'll be writing Lua filters for this sort of thing going into the future!)
Or, alternatively, does Typst CSS happen early enough that I can include custom styles (only the ones specifically translated by Quarto) in a CSS stylesheet, use class names on fenced divs and trust that the CSS styles will be translated by Quarto? The examples given in the Quarto docs have only inline styles being translated, so I'm currently assuming that styles attached to Pandoc classes or any other kind of CSS cascade are not processed.
I think the sort of thing I'm hoping to do is more like:
Also, small aside — the link in the documentation to the Quarto filter for Typst CSS ("Lua filter which translates CSS properties to Typst") appears to be broken, as the file has been renamed: it's now
https://github.com/quarto-dev/quarto-cli/blob/main/src/resources/filters/quarto-post/typst-css-property-processing.lua
, notBeta Was this translation helpful? Give feedback.
All reactions