twig/model
Types
Phantom type for heading attributes.
pub type HeadingAttr
Controls the marker style of a bullet list.
DefaultMarkerlets Typst use its default bulletTextMarkeraccepts any string to use as the bullet marker
pub type Marker {
DefaultMarker
TextMarker(String)
}
Constructors
-
DefaultMarker -
TextMarker(String)
Controls how a heading is numbered.
NoNumberingrenders asnumbering: noneNumberingPatternaccepts a Typst numbering pattern string like"1.a."
pub type Numbering {
NoNumbering
NumberingPattern(String)
}
Constructors
-
NoNumbering -
NumberingPattern(String)
Phantom type for strong attributes.
pub type StrongAttr
Values
pub fn bullet_list(
attrs: List(twig.Attr(ListAttr)),
children: List(twig.Content),
) -> twig.Content
Creates a bullet list element. Each child becomes a list item.
Example
bullet_list([], [text("item1"), text("item2")])
// -> "#list[item1][item2]"
pub fn emph(
attrs: List(twig.Attr(EmphAttr)),
children: List(twig.Content),
) -> twig.Content
Creates an emphasis (italic) element.
Example
emph([], [text("italic")])
// -> "#emph[italic]"
pub fn heading(
attrs: List(twig.Attr(HeadingAttr)),
children: List(twig.Content),
) -> twig.Content
Creates a heading element.
Example
heading([level(1)], [text("My Document")])
// -> "#heading(level: 1)[My Document]"
pub fn level(n: Int) -> twig.Attr(HeadingAttr)
Sets the level of a heading, from 1 (top) to 6 (lowest).
Example
heading([level(2)], [text("Introduction")])
// -> "#heading(level: 2)[Introduction]"
pub fn marker(m: Marker) -> twig.Attr(ListAttr)
Sets the marker style for a bullet list.
Example
bullet_list([marker(TextMarker("--"))], [text("item1")])
// -> "#list(marker: [--])[item1]"
pub fn numbering(n: Numbering) -> twig.Attr(HeadingAttr)
Sets the numbering style of a heading.
Example
heading([level(1), numbering(NumberingPattern("1.a."))], [text("Hello")])
// -> "#heading(level: 1, numbering: "1.a.")[Hello]"
pub fn strong(
attrs: List(twig.Attr(StrongAttr)),
children: List(twig.Content),
) -> twig.Content
Creates a strong (bold) element.
Example
strong([], [text("bold")])
// -> "#strong[bold]"