Why aren’t the Heading and outline available as a package in typst?
Heading s and outline s are provided in a standard library. They cannot be provided as standard libraries, because there is only a single “standard library” (std
) and they are just elements, so they can’t include anything other than themselves, so it’s useless. They are implemented in Rust, because Typst as a whole is implemented in Rust.
I mean, why not use the *.typ code to provide heading and outline functions? That way, writing code becomes easier to understand, and modifications are easier and more flexible!
Andrew
May 17, 2025, 10:52am
4
Are you talking about this?
opened 09:01AM - 02 Oct 24 UTC
docs
styling
### Description
I recently [was looking](https://forum.typst.app/t/how-do-i-kno… w-what-elements-compose-a-function-for-styling-purposes/822) at how I could know what elements to style to change the appearance of some other element (in my example, `quote`). In that case, there is no way to do what I was suggesting with `set` rules, so the only option is a `show` rule.
However, working out how to replicate the existing appearance, except for some small tweak, either requires trial and error or reading through the Rust implementation code.
Could a "null"/identity show rule be included in the documentation for every element showing how to style it in typst as it is styled in Rust? For example, for a quote, that might look something like this
```typst
#show quote: it => {
let body = it.body
if (it.quotes == auto and not it.block) or it.quotes == true {
body = ["] + body + ["]
}
if it.block {
body = block(body)
if it.attribution != none {
body += align(end, [— ] + it.attribution)
}
body = pad(body)
}
body
}
```
(this isn't perfectly accurate as the between the quote and the attribution isn't quite right).
So some element
```typst
#let el = quote(attribution: [Shakespeare], [To be, or not to be, that is the question], block: true)
```
before and after the `show` rule should be visually identical.
How exactly are you expecting to interact with it in your document? Where would those files go?