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? #

[View source]
def block_quote? #

[View source]
def code? #

[View source]
def code_block? #

[View source]
def commonmark? #

[View source]
def container? #

[View source]
def custom_block? #

[View source]
def custom_inline? #

[View source]
def document? #

[View source]
def emph? #

[View source]
def footnote_definition? #

[View source]
def footnote_reference? #

[View source]
def gfm? #

[View source]
def heading? #

[View source]
def html_block? #

[View source]
def html_inline? #

[View source]
def image? #

[View source]
def inline? #

[View source]
def item? #

[View source]
def leaf? #

[View source]
def linebreak? #

[View source]
def link? #

[View source]
def list? #

[View source]
def none? #

[View source]
def paragraph? #

[View source]
def softbreak? #

[View source]
def strikethrough? #

[View source]
def strong? #

[View source]
def syntax_extension? #

[View source]
def table? #

[View source]
def table_cell? #

[View source]
def table_row? #

[View source]
def text? #

[View source]
def thematic_break? #

[View source]