enum Cmark::NodeType

Overview

Represents the type of a node.

If valid, the type can be grouped into several categories:

  1. block or inline; 2) Commonmark or GFM; and 3) container or leaf. Use the respective method to check the node type category:
  1. #block? or #inline?
  2. #commonmark? or #gfm?
  3. #container? or #leaf?

If the node is invalid it has the type None, and all of the previous methods will return false.

Commonmark:

GFM:

Leaf nodes:

NOTE The GFM syntax extension for tasklists does not create a new node type. That is, a tasklist item has NodeType::Item. To check if a given node is a tasklist item use Node#tasklist_item?; to set if a list item node represents a tasklist or not use Node#tasklist_item=.

NOTE Both footnote elements are part of GFM, but they are not syntax extensions and they are not defined in the GFM spec. Therefore, they can be enabled in so-called Commonmark-only methods using Option::Footnotes. Normal inconsistencies when trying to define a standard specification‽ For more information regarding footnotes in cmark-gfm see this pull request. To check if an element is part of a syntax extension use #syntax_extension?.

NOTE The numeric values of GFM extensions types do not correspond to their counterpart in the C library because these are not predefined constants, they are dynamically registered at runtime.

Defined in:

cmark/node_type.cr

Enum Members

None = 0

Invalid node

Document = 32769

Commonmark / Block / Container

BlockQuote = 32770

Commonmark / Block / Container

List = 32771

Commonmark / Block / Container

Item = 32772

Commonmark / Block / Container

CodeBlock = 32773

Commonmark / Block / Leaf

HTMLBlock = 32774

Commonmark / Block / Container

CustomBlock = 32775

Commonmark / Block / Container

Paragraph = 32776

Commonmark / Block / Container

Heading = 32777

Commonmark / Block / Container

ThematicBreak = 32778

Commonmark / Block / Leaf

FootnoteDefinition = 32779

GFM / Block / Container

Text = 49153

Commonmark / Inline / Leaf

Softbreak = 49154

Commonmark / Inline / Leaf

Linebreak = 49155

Commonmark / Inline / Leaf

Code = 49156

Commonmark / Inline / Leaf

HTMLInline = 49157

Commonmark / Inline / Leaf

CustomInline = 49158

Commonmark / Inline / Container

Emph = 49159

Commonmark / Inline / Container

Strong = 49160

Commonmark / Inline / Container

Link = 49161

Commonmark / Inline / Container

Image = 49162

Commonmark / Inline / Container

FootnoteReference = 49163

GFM / Inline / Container

Table = 32785

GFM / Block / Container

TableRow = 32786

GFM / Block / Container

TableCell = 32787

GFM / Block / Container

Strikethrough = 49169

GFM / Inline / Container

Instance Method Summary

Instance Method Detail

def block? #

def block_quote? #

def code? #

def code_block? #

def commonmark? #

def container? #

def custom_block? #

def custom_inline? #

def document? #

def emph? #

def footnote_definition? #

def footnote_reference? #

def gfm? #

def heading? #

def html_block? #

def html_inline? #

def image? #

def inline? #

def item? #

def leaf? #

def linebreak? #

def link? #

def list? #

def none? #

def paragraph? #

def softbreak? #

def strikethrough? #

def strong? #

def syntax_extension? #

def table? #

def table_cell? #

def table_row? #

def text? #

def thematic_break? #