Quick reference for Quillon's nodes, marks, and functions.
Node Types
Container
| Type | Factory | Attrs |
|---|
:document | document(), document(children) | - |
Blocks
| Type | Factory | Attrs |
|---|
:paragraph | paragraph(), paragraph(content) | - |
:heading | heading(level), heading(level, content) | level (1-6, required) |
:divider | divider(), divider(style) | style (:solid, :dashed, :dotted) |
:blockquote | blockquote(children), blockquote(children, citation) | citation |
:callout | callout(type, children), callout(type, children, title) | type (required), title |
:code_block | code_block(code), code_block(code, language) | code (required), language |
:image | image(src), image(src, alt), image(src, alt, opts) | src (required), alt, caption, width |
:video | video(src), video(src, opts) | src (required), poster |
:bullet_list | bullet_list(), bullet_list(items) | - |
:ordered_list | ordered_list(), ordered_list(items), ordered_list(items, start) | start (default: 1) |
:table | table(), table(rows) | - |
List Content
| Type | Factory | Attrs |
|---|
:list_item | list_item(), list_item(children) | - |
Table Content
| Type | Factory | Attrs |
|---|
:table_row | table_row(), table_row(cells), table_row(cells, opts) | header (default: false) |
:table_cell | table_cell(), table_cell(children), table_cell(children, opts) | colspan, rowspan (default: 1) |
Inline
| Type | Factory | Attrs |
|---|
:text | text(content), text(content, marks) | text (required), marks (default: []) |
Marks
Simple Marks (atoms)
| Mark | Description |
|---|
:bold | Bold text |
:italic | Italic text |
:underline | Underlined text |
:strike | Strikethrough text |
:code | Inline code |
:subscript | Subscript (H₂O) |
:superscript | Superscript (x²) |
Attributed Marks (tuples)
| Mark | Attrs | Example |
|---|
:link | href (required), title, target | {:link, %{href: "https://example.com"}} |
:highlight | color (required) | {:highlight, %{color: "yellow"}} |
:font_color | color (required) | {:font_color, %{color: "#ff0000"}} |
:mention | id, type, label (all required) | {:mention, %{id: "123", type: "user", label: "@alice"}} |
Mark Exclusions
:subscript and :superscript exclude each other:code excludes :link
Simple Mark Toggles
toggle_bold(block, start, end)
toggle_italic(block, start, end)
toggle_underline(block, start, end)
toggle_strike(block, start, end)
toggle_code(block, start, end)
toggle_subscript(block, start, end)
toggle_superscript(block, start, end)
Attributed Mark Commands
set_link(block, start, end, href_or_attrs)
unset_link(block, start, end)
set_highlight(block, start, end, color)
unset_highlight(block, start, end)
set_font_color(block, start, end, color)
unset_font_color(block, start, end)
set_mention(block, start, end, attrs)
unset_mention(block, start, end)
Utility Commands
clear_formatting(block, start, end)
selection_has_mark?(block, start, end, mark_type)
Path Operations
Path-based
get(node, path) # {:ok, node} | {:error, :invalid_path}
update(node, path, fun) # {:ok, node} | {:error, :invalid_path}
insert(node, path, new_node) # {:ok, node} | {:error, :invalid_path}
delete(node, path) # {:ok, node} | {:error, :invalid_path}
move(node, from_path, to_path) # {:ok, node} | {:error, :invalid_path}
reorder(node, path, id_list) # {:ok, node} | {:error, :invalid_path}
ID-based
find_path(node, id) # {:ok, path} | {:error, :not_found}
get_by_id(node, id) # {:ok, node} | {:error, :not_found}
update_by_id(node, id, fun) # {:ok, node} | {:error, :not_found}
Node Inspection
Accessors
type(node) # => :paragraph
attrs(node) # => %{level: 1}
children(node) # => [...]
Predicates
node?(value) # Is it a valid node tuple?
block?(node) # Is it a block type?
inline?(node) # Is it an inline type?
container?(node) # Is it a container type?
# Specific type checks
document?(node)
paragraph?(node)
heading?(node)
divider?(node)
blockquote?(node)
callout?(node)
code_block?(node)
image?(node)
video?(node)
bullet_list?(node)
ordered_list?(node)
list?(node) # bullet_list or ordered_list
list_item?(node)
table?(node)
table_row?(node)
table_cell?(node)
text?(node)
Mark Utilities
mark?(value) # Is it a valid mark?
simple?(mark) # Is it a simple mark (atom)?
attributed?(mark) # Is it an attributed mark (tuple)?
mark_type(mark) # Get the type (:bold, :link, etc.)
mark_attrs(mark) # Get attrs (nil for simple marks)
has_mark?(marks, type) # Does the list contain this mark type?
get_mark(marks, type) # Get the mark from the list
add_mark(marks, mark) # Add mark to list
remove_mark(marks, type) # Remove mark from list
toggle_mark(marks, mark) # Toggle mark in list
marks_equal?(m1, m2) # Compare two mark lists
JSON Serialization
to_json(node) # => %{"type" => "...", "attrs" => %{}, "children" => [...]}
from_json(json) # => {:ok, node} | {:error, message}
from_json!(json) # => node | raises ArgumentError
Schema Validation
validate(node) # {:ok, node} | {:error, errors}
validate(node, schema) # with custom schema
validate!(node) # node | raises
validate!(node, schema) # with custom schema
Table Commands
add_row(table, index)
remove_row(table, index)
add_column(table, index)
remove_column(table, index)
List Commands
toggle_list_type(list) # bullet_list <-> ordered_list
Type Constants
container_types() # [:document]
block_types() # [:paragraph, :heading, ...]
inline_types() # [:text]
list_content_types() # [:list_item]
table_content_types() # [:table_row]
table_row_content_types() # [:table_cell]
node_types() # All node types
simple_marks() # [:bold, :italic, ...]
attributed_marks() # [:link, :highlight, ...]
all_marks() # All mark types
heading_levels() # 1..6
divider_styles() # [:solid, :dashed, :dotted]
callout_types() # [:info, :warning, :success, :error]
link_attrs() # [:href, :title, :target]
highlight_attrs() # [:color]
font_color_attrs() # [:color]
mention_attrs() # [:id, :type, :label]