Typst.Format.Table (Typst v0.1.4)
View SourceCreates a typst #table()
and implements the String.Chars
protocol for easy EEx interpolation.
To build more complex tables you can use the structs under this module like Typst.Format.Table.Hline
Examples
iex> alias Typst.Format.Table
...> %Table{columns: 2, content: [["hello", "world"], ["foo", "bar"]]} |> to_string()
"#table(columns: 2, [hello], [world], [foo], [bar])"
iex> alias Typst.Format.Table
...> alias Typst.Format.Table.Hline
...> import Typst.Format
...> %Table{columns: array(["1fr", "1fr"]), content: [["hello", "world"], %Hline{start: 1}, ["foo", "bar"]]} |> to_string()
"#table(columns: (1fr, 1fr), [hello], [world], table.hline(start: 1), [foo], [bar])"
Summary
Types
@type t() :: %Typst.Format.Table{ align: String.t(), column_gutter: non_neg_integer() | String.t(), columns: non_neg_integer() | String.t(), content: String.Chars.t() | [String.Chars.t()], fill: String.t(), gutter: non_neg_integer() | String.t(), inset: String.t(), row_gutter: non_neg_integer() | String.t(), rows: non_neg_integer() | String.t(), stroke: String.t() }