Quillon (Quillon v0.1.0)

Copy Markdown View Source

A pure Elixir library for structured document representation with rich text support.

Documents are trees of nodes represented as tuples: {type, attrs, children}

Quick Start

# Create a simple document
doc = Quillon.document([
  Quillon.heading(1, "Welcome"),
  Quillon.paragraph("Hello world!")
])

# Convert to JSON
json = Quillon.to_json(doc)

# Parse from JSON
{:ok, doc} = Quillon.from_json(json)

Node Types

  • Container: :document
  • Block: :paragraph, :heading, :divider, :blockquote, :callout, :code_block, :image, :video, :bullet_list, :ordered_list, :table
  • List content: :list_item
  • Table content: :table_row, :table_cell
  • Inline: :text

Marks

Marks apply formatting to text nodes:

  • Simple marks: :bold, :italic, :underline, :strike, :code
  • Attributed marks: {:link, %{href: "..."}}

Summary

Functions

Functions

add_column(table, index)

See Quillon.Commands.Table.add_column/2.

add_mark(marks, mark)

See Quillon.Mark.add_mark/2.

add_row(table, index)

See Quillon.Commands.Table.add_row/2.

all_marks()

See Quillon.Types.all_marks/0.

apply_mark(block, start_offset, end_offset, mark)

See Quillon.Transform.apply_mark/4.

attributed?(mark)

See Quillon.Mark.attributed?/1.

attributed_marks()

See Quillon.Types.attributed_marks/0.

attrs(node)

See Quillon.Node.attrs/1.

block?(node)

See Quillon.Node.block?/1.

block_types()

See Quillon.Types.block_types/0.

blockquote()

See Quillon.Factory.blockquote/0.

blockquote(children)

See Quillon.Factory.blockquote/1.

blockquote(children, citation)

See Quillon.Factory.blockquote/2.

blockquote?(node)

See Quillon.Node.blockquote?/1.

bullet_list()

See Quillon.Factory.bullet_list/0.

bullet_list(items)

See Quillon.Factory.bullet_list/1.

bullet_list?(node)

See Quillon.Node.bullet_list?/1.

callout(type)

See Quillon.Factory.callout/1.

callout(type, children)

See Quillon.Factory.callout/2.

callout(type, children, title)

See Quillon.Factory.callout/3.

callout?(node)

See Quillon.Node.callout?/1.

callout_types()

See Quillon.Types.callout_types/0.

children(node)

See Quillon.Node.children/1.

clear_formatting(block, start_offset, end_offset)

See Quillon.Commands.clear_formatting/3.

code_block(code)

See Quillon.Factory.code_block/1.

code_block(code, language)

See Quillon.Factory.code_block/2.

code_block?(node)

See Quillon.Node.code_block?/1.

container?(node)

See Quillon.Node.container?/1.

container_types()

See Quillon.Types.container_types/0.

delete(node, path)

See Quillon.Path.delete/2.

divider()

See Quillon.Factory.divider/0.

divider(style)

See Quillon.Factory.divider/1.

divider?(node)

See Quillon.Node.divider?/1.

divider_styles()

See Quillon.Types.divider_styles/0.

document()

See Quillon.Factory.document/0.

document(children)

See Quillon.Factory.document/1.

document(attrs, children)

See Quillon.Factory.document/2.

document?(node)

See Quillon.Node.document?/1.

find_path(node, id)

See Quillon.Path.find_path/2.

font_color_attrs()

See Quillon.Types.font_color_attrs/0.

from_json(json)

See Quillon.JSON.from_json/1.

from_json!(json)

See Quillon.JSON.from_json!/1.

get(node, path)

See Quillon.Path.get/2.

get_by_id(node, id)

See Quillon.Path.get_by_id/2.

get_mark(marks, type)

See Quillon.Mark.get_mark/2.

has_mark?(marks, type)

See Quillon.Mark.has_mark?/2.

heading(level)

See Quillon.Factory.heading/1.

heading(level, content)

See Quillon.Factory.heading/2.

heading?(node)

See Quillon.Node.heading?/1.

heading_levels()

See Quillon.Types.heading_levels/0.

highlight_attrs()

See Quillon.Types.highlight_attrs/0.

image(src)

See Quillon.Factory.image/1.

image(src, alt)

See Quillon.Factory.image/2.

image(src, alt, opts)

See Quillon.Factory.image/3.

image?(node)

See Quillon.Node.image?/1.

inline?(node)

See Quillon.Node.inline?/1.

inline_types()

See Quillon.Types.inline_types/0.

insert(node, path, new_node)

See Quillon.Path.insert/3.

list?(node)

See Quillon.Node.list?/1.

list_content_types()

See Quillon.Types.list_content_types/0.

list_item()

See Quillon.Factory.list_item/0.

list_item(children)

See Quillon.Factory.list_item/1.

list_item?(node)

See Quillon.Node.list_item?/1.

mark?(value)

See Quillon.Mark.mark?/1.

mark_attrs(mark)

See Quillon.Mark.mark_attrs/1.

mark_type(mark)

See Quillon.Mark.mark_type/1.

marks_equal?(marks1, marks2)

See Quillon.Mark.marks_equal?/2.

mention_attrs()

See Quillon.Types.mention_attrs/0.

move(node, from_path, to_path)

See Quillon.Path.move/3.

new(type, attrs)

See Quillon.Factory.new/2.

new(type, attrs, children)

See Quillon.Factory.new/3.

node?(value)

See Quillon.Node.node?/1.

node_types()

See Quillon.Types.node_types/0.

normalize(block)

See Quillon.Transform.normalize/1.

offset_to_position(children, offset)

See Quillon.Transform.offset_to_position/2.

ordered_list()

See Quillon.Factory.ordered_list/0.

ordered_list(items)

See Quillon.Factory.ordered_list/1.

ordered_list(items, start)

See Quillon.Factory.ordered_list/2.

ordered_list?(node)

See Quillon.Node.ordered_list?/1.

paragraph()

See Quillon.Factory.paragraph/0.

paragraph(content)

See Quillon.Factory.paragraph/1.

paragraph?(node)

See Quillon.Node.paragraph?/1.

position_to_offset(children, position)

See Quillon.Transform.position_to_offset/2.

range_has_mark?(block, start_offset, end_offset, mark_type)

See Quillon.Transform.range_has_mark?/4.

remove_column(table, index)

See Quillon.Commands.Table.remove_column/2.

remove_mark(marks, type)

See Quillon.Mark.remove_mark/2.

remove_mark(block, start_offset, end_offset, mark_type)

See Quillon.Transform.remove_mark/4.

remove_row(table, index)

See Quillon.Commands.Table.remove_row/2.

reorder(node, path, id_list)

See Quillon.Path.reorder/3.

selection_has_mark?(block, start_offset, end_offset, mark_type)

See Quillon.Commands.selection_has_mark?/4.

set_font_color(block, start_offset, end_offset, color)

See Quillon.Commands.set_font_color/4.

set_highlight(block, start_offset, end_offset, color)

See Quillon.Commands.set_highlight/4.

set_link(block, start_offset, end_offset, href_or_attrs)

See Quillon.Commands.set_link/4.

set_mention(block, start_offset, end_offset, attrs)

See Quillon.Commands.set_mention/4.

simple?(mark)

See Quillon.Mark.simple?/1.

simple_marks()

See Quillon.Types.simple_marks/0.

sort_marks(marks)

See Quillon.Transform.sort_marks/1.

split_at_offset(children, offset)

See Quillon.Transform.split_at_offset/2.

split_range(children, start_offset, end_offset)

See Quillon.Transform.split_range/3.

table()

See Quillon.Factory.table/0.

table(rows)

See Quillon.Factory.table/1.

table?(node)

See Quillon.Node.table?/1.

table_cell()

See Quillon.Factory.table_cell/0.

table_cell(children)

See Quillon.Factory.table_cell/1.

table_cell(children, opts)

See Quillon.Factory.table_cell/2.

table_cell?(node)

See Quillon.Node.table_cell?/1.

table_content_types()

See Quillon.Types.table_content_types/0.

table_row()

See Quillon.Factory.table_row/0.

table_row(cells)

See Quillon.Factory.table_row/1.

table_row(cells, opts)

See Quillon.Factory.table_row/2.

table_row?(node)

See Quillon.Node.table_row?/1.

table_row_content_types()

See Quillon.Types.table_row_content_types/0.

text(content)

See Quillon.Factory.text/1.

text(content, marks)

See Quillon.Factory.text/2.

text?(node)

See Quillon.Node.text?/1.

to_json(node)

See Quillon.JSON.to_json/1.

toggle_bold(block, start_offset, end_offset)

See Quillon.Commands.toggle_bold/3.

toggle_code(block, start_offset, end_offset)

See Quillon.Commands.toggle_code/3.

toggle_italic(block, start_offset, end_offset)

See Quillon.Commands.toggle_italic/3.

toggle_list_type(list)

See Quillon.Commands.List.toggle_list_type/1.

toggle_mark(marks, mark)

See Quillon.Mark.toggle_mark/2.

toggle_mark(block, start_offset, end_offset, mark)

See Quillon.Transform.toggle_mark/4.

toggle_strike(block, start_offset, end_offset)

See Quillon.Commands.toggle_strike/3.

toggle_subscript(block, start_offset, end_offset)

See Quillon.Commands.toggle_subscript/3.

toggle_superscript(block, start_offset, end_offset)

See Quillon.Commands.toggle_superscript/3.

toggle_underline(block, start_offset, end_offset)

See Quillon.Commands.toggle_underline/3.

type(node)

See Quillon.Node.type/1.

unset_font_color(block, start_offset, end_offset)

See Quillon.Commands.unset_font_color/3.

unset_highlight(block, start_offset, end_offset)

See Quillon.Commands.unset_highlight/3.

unset_link(block, start_offset, end_offset)

See Quillon.Commands.unset_link/3.

unset_mention(block, start_offset, end_offset)

See Quillon.Commands.unset_mention/3.

update(node, path, fun)

See Quillon.Path.update/3.

update_by_id(node, id, fun)

See Quillon.Path.update_by_id/3.

validate(node)

See Quillon.Schema.Validator.validate/1.

validate(node, schema)

See Quillon.Schema.Validator.validate/2.

validate!(node)

See Quillon.Schema.Validator.validate!/1.

validate!(node, schema)

See Quillon.Schema.Validator.validate!/2.

video(src)

See Quillon.Factory.video/1.

video(src, opts)

See Quillon.Factory.video/2.

video?(node)

See Quillon.Node.video?/1.