Skip to main content

Module attributes

Module attributes 

Source
Expand description

Parsing for Pandoc-style attributes: {#id .class key=value}

Attributes can appear after headings, fenced code blocks, fenced divs, etc. Syntax: {#identifier .class1 .class2 key1=val1 key2=“val2”}

Rules:

  • Surrounded by { }
  • Identifier: #id (optional, only first one counts)
  • Classes: .class (can have multiple)
  • Key-value pairs: key=value or key=“value” or key=‘value’ (can have multiple)
  • Whitespace flexible between items

Structs§

AttributeBlock

Functions§

emit_attributes
Emit attribute block as AST nodes
parse_attribute_content
Parse the content inside the attribute braces
try_parse_trailing_attributes
Try to parse an attribute block from the end of a string Returns: (attribute_block, text_before_attributes)
try_parse_trailing_attributes_with_pos
Try to parse an attribute block from the end of a string. Returns: (attribute_block, text_before_attributes, open_brace_position_in_trimmed_text)