typst/tests/typ/style/show-recursive.typ
Laurenz efd1853d06 Show it!
- New show rule syntax
- Set if syntax
- Removed wrap syntax
2022-11-07 12:46:05 +01:00

67 lines
943 B
Typst

// Test recursive show rules.
---
// Test basic identity.
#show heading: it => it
= Heading
---
// Test more recipes down the chain.
#show list: scale.with(origin: left, x: 80%)
#show heading: []
#show enum: []
- Actual
- Tight
- List
= Nope
---
// Test recursive base recipe. (Burn it with fire!)
#set list(label: [- Hey])
- Labelless
- List
---
// Test show rule in function.
#let starwars(body) = [
#show list: it => {
stack(dir: ltr,
text(red, it),
1fr,
scale(x: -100%, text(blue, it)),
)
}
#body
]
- Normal list
#starwars[
- Star
- Wars
- List
]
- Normal list
---
// Test multi-recursion with nested lists.
#set rect(inset: 2pt)
#show list: rect.with(stroke: blue)
#show list: rect.with(stroke: red)
- List
- Nested
- List
- Recursive!
---
// Inner heading is not finalized. Bug?
#set heading(around: none)
#show heading: it => it.body
#show heading: [
= A [
= B
]
]
= Discarded