The information-preserving document model produced by ExAnydoc.to_document/2.
blocks contains the document body in reading order. notes contains
footnotes and endnotes, while assets retains embedded files together with
their original bytes.
Blocks and inline elements are represented as tagged tuples that mirror the variants in anydoc's recursive model.
See the document model guide for traversal examples and the complete table representation.
Summary
Types
An embedded asset whose bytes are retained by the model.
A recursive block-level document element.
A slot in a table grid.
The source of an image.
An inline document element.
A target used by a link.
A list item in the document model.
A footnote or endnote.
Character formatting applied to an inline text run.
A data or layout table.
A table cell containing block-level content.
Types
@type asset() :: %{ id: non_neg_integer(), media_type: String.t(), origin_part: String.t(), bytes: binary() }
An embedded asset whose bytes are retained by the model.
@type block() :: {:heading, %{level: pos_integer(), anchor: String.t() | nil, content: [inline()]}} | {:paragraph, [inline()]} | {:list, %{ marker: :bullet | :decimal | :lower_alpha | :upper_alpha | :lower_roman | :upper_roman, start: non_neg_integer(), items: [list_item()] }} | {:table, table()} | {:block_quote, [block()]} | {:code_block, %{lang: String.t() | nil, text: String.t()}} | :rule
A recursive block-level document element.
@type cell_slot() :: {:origin, table_cell()} | {:covered, %{origin_row: non_neg_integer(), origin_col: non_neg_integer()}}
A slot in a table grid.
@type image_source() :: {:external, String.t()} | {:asset, non_neg_integer()} | :unavailable
The source of an image.
@type inline() :: {:text, %{text: String.t(), style: style()}} | {:link, %{content: [inline()], target: link_target()}} | {:image, %{alt: String.t(), source: image_source()}} | {:anchor, String.t()} | {:note_ref, String.t()} | :line_break
An inline document element.
A target used by a link.
@type list_item() :: %{ blocks: [block()], checked: boolean() | nil, marker_label: String.t() | nil }
A list item in the document model.
A footnote or endnote.
Character formatting applied to an inline text run.
@type table() :: %{ grid: [[cell_slot()]], header_rows: non_neg_integer(), kind: :data | :layout }
A data or layout table.
@type table_cell() :: %{ blocks: [block()], col_span: pos_integer(), row_span: pos_integer() }
A table cell containing block-level content.