Jido.Chat.Markdown.Node (Jido Chat v1.0.0)

Copy Markdown View Source

Canonical Markdown AST node used by Jido.Chat.Markdown.

Summary

Functions

Builds a Markdown node from serialized map data.

Creates a canonical Markdown node.

Normalizes a Markdown node input.

Returns the schema for a Markdown node.

Serializes a Markdown node into a plain map with a type marker.

Types

node_type()

@type node_type() ::
  :root
  | :paragraph
  | :text
  | :strong
  | :emphasis
  | :link
  | :code
  | :code_block
  | :heading
  | :list
  | :list_item
  | :blockquote
  | :table
  | :table_row
  | :table_cell
  | :divider

t()

@type t() :: %Jido.Chat.Markdown.Node{
  align: nil | nil | binary(),
  children: [any()],
  language: nil | nil | binary(),
  level: nil | nil | integer(),
  metadata: map(),
  ordered: nil | nil | boolean(),
  start: nil | nil | integer(),
  text: nil | nil | binary(),
  type:
    :root
    | :paragraph
    | :text
    | :strong
    | :emphasis
    | :link
    | :code
    | :code_block
    | :heading
    | :list
    | :list_item
    | :blockquote
    | :table
    | :table_row
    | :table_cell
    | :divider,
  url: nil | nil | binary()
}

Functions

from_map(map)

@spec from_map(map()) :: t()

Builds a Markdown node from serialized map data.

new(node)

@spec new(t() | map()) :: t()

Creates a canonical Markdown node.

normalize(node)

@spec normalize(t() | map() | String.t() | nil) :: t() | nil

Normalizes a Markdown node input.

schema()

Returns the schema for a Markdown node.

to_map(node)

@spec to_map(t()) :: map()

Serializes a Markdown node into a plain map with a type marker.