Quick reference for Quillon's nodes, marks, and functions.

Node Types

Container

TypeFactoryAttrs
:documentdocument(), document(children)-

Blocks

TypeFactoryAttrs
:paragraphparagraph(), paragraph(content)-
:headingheading(level), heading(level, content)level (1-6, required)
:dividerdivider(), divider(style)style (:solid, :dashed, :dotted)
:blockquoteblockquote(children), blockquote(children, citation)citation
:calloutcallout(type, children), callout(type, children, title)type (required), title
:code_blockcode_block(code), code_block(code, language)code (required), language
:imageimage(src), image(src, alt), image(src, alt, opts)src (required), alt, caption, width
:videovideo(src), video(src, opts)src (required), poster
:bullet_listbullet_list(), bullet_list(items)-
:ordered_listordered_list(), ordered_list(items), ordered_list(items, start)start (default: 1)
:tabletable(), table(rows)-

List Content

TypeFactoryAttrs
:list_itemlist_item(), list_item(children)-

Table Content

TypeFactoryAttrs
:table_rowtable_row(), table_row(cells), table_row(cells, opts)header (default: false)
:table_celltable_cell(), table_cell(children), table_cell(children, opts)colspan, rowspan (default: 1)

Inline

TypeFactoryAttrs
:texttext(content), text(content, marks)text (required), marks (default: [])

Marks

Simple Marks (atoms)

MarkDescription
:boldBold text
:italicItalic text
:underlineUnderlined text
:strikeStrikethrough text
:codeInline code
:subscriptSubscript (H₂O)
:superscriptSuperscript (x²)

Attributed Marks (tuples)

MarkAttrsExample
:linkhref (required), title, target{:link, %{href: "https://example.com"}}
:highlightcolor (required){:highlight, %{color: "yellow"}}
:font_colorcolor (required){:font_color, %{color: "#ff0000"}}
:mentionid, type, label (all required){:mention, %{id: "123", type: "user", label: "@alice"}}

Mark Exclusions

  • :subscript and :superscript exclude each other
  • :code excludes :link

Formatting Commands

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]