Crate acdc_parser

Crate acdc_parser 

Source
Expand description

AsciiDoc parser.

This module provides a parser for the AsciiDoc markup language. The parser is implemented using the peg parser generator.

§Quick Start

The parser is implemented as a struct that implements the Parser trait. The trait provides two methods for parsing AsciiDoc content:

  • parse: parses a string containing AsciiDoc content.
  • parse_file: parses the content of a file containing AsciiDoc content.

use acdc_parser::{Document, parse};

let content = r#"= Document Title

This is a paragraph.

== Section Title

This is a subsection."#;

let options = acdc_parser::Options::default();
let document = parse(content, &options).unwrap();

println!("{:?}", document);

Structs§

Admonition
An Admonition represents an admonition in a document.
Anchor
An Anchor represents an anchor in a document.
Audio
An Audio represents an audio block in a document.
Author
An Author represents the author of a document.
Autolink
An Autolink represents an inline autolink in a document.
BlockMetadata
A BlockMetadata represents the metadata of a block in a document.
Bold
A Bold represents a bold section of text in a document.
Button
A Button represents an inline button in a document.
CalloutList
A CalloutList represents a callout list in a document.
ColumnFormat
Column format specification for table formatting
Comment
A single-line comment in a document.
CrossReference
A CrossReference represents an inline cross-reference (xref) in a document.
CurvedApostrophe
A CurvedApostrophe represents a curved apostrophe section of text in a document.
CurvedQuotation
A CurvedQuotation represents a curved quotation section of text in a document.
DelimitedBlock
A DelimitedBlock represents a delimited block in a document.
DescriptionList
A DescriptionList represents a description list in a document.
DescriptionListItem
An item in a description list (term + description).
DiscreteHeader
A DiscreteHeader represents a discrete header in a document.
Document
A Document represents the root of an AsciiDoc document.
DocumentAttribute
A DocumentAttribute represents a document attribute in a document.
DocumentAttributes
Document-level attributes with universal defaults.
ElementAttributes
Element-level attributes (for blocks, sections, etc.).
Footnote
A Footnote represents an inline footnote in a document.
Header
A Header represents the header of a document.
Highlight
A Highlight represents a highlighted section of text in a document.
Icon
An Icon represents an inline icon in a document.
Image
An Image represents an image block in a document.
Italic
An Italic represents an italic section of text in a document.
Keyboard
A Keyboard represents an inline keyboard shortcut in a document.
LineBreak
A LineBreak represents a line break (inline).
Link
A Link represents an inline link in a document.
ListItem
A ListItem represents a list item in a document.
Location
A Location represents a location in a document.
Mailto
An Mailto represents an inline mailto: in a document.
Menu
A Menu represents an inline menu in a document.
Monospace
A Monospace represents a monospace section of text in a document.
Options
OptionsBuilder
Builder for Options that provides an API for configuration.
OrderedList
An OrderedList represents an ordered list in a document.
PageBreak
A PageBreak represents a page break in a document.
Paragraph
A Paragraph represents a paragraph in a document.
Parser
Type-based parser for AsciiDoc content.
Pass
A Pass represents a passthrough macro in a document.
Plain
A Plain represents a plain text section in a document.
Position
A Position represents a human-readable position in a document.
Raw
A Raw represents a raw text section in a document.
Section
A Section represents a section in a document.
SourceLocation
Source location information combining file path and positioning
StandaloneCurvedApostrophe
A StandaloneCurvedApostrophe represents a standalone curved apostrophe character.
Stem
A Stem represents an inline mathematical expression.
StemContent
Content of a stem block with math notation.
Subscript
A Subscript represents a subscript section of text in a document.
Superscript
A Superscript represents a superscript section of text in a document.
Table
A Table represents a table in a document.
TableColumn
A TableColumn represents a column/cell in a table row.
TableOfContents
A TableOfContents represents a table of contents block.
TableRow
A row in a table, containing one or more columns (cells).
ThematicBreak
A ThematicBreak represents a thematic break in a document.
Title
A title in a document (section titles, block titles, document title, etc.).
TocEntry
A TocEntry represents a table of contents entry.
UnorderedList
A UnorderedList represents an unordered list in a document.
Url
An Url represents an inline URL in a document.
Verbatim
A Verbatim represents verbatim text section in a document.
Video
A Video represents a video block in a document.

Enums§

AdmonitionVariant
The variant/type of an admonition block.
AttributeValue
An AttributeValue represents the value of an attribute in a document.
Block
A Block represents a block in a document.
ColumnStyle
Column content style
ColumnWidth
Column width specification
DelimitedBlockType
The inner content type of a delimited block.
Error
Form
The form of an inline formatting element (how it was expressed in the source)
HorizontalAlignment
Horizontal alignment for table cells
InlineMacro
An inline macro - a functional element that produces inline content.
InlineNode
An InlineNode represents an inline node in a document.
ListItemCheckedStatus
A ListItemCheckedStatus represents the checked status of a list item.
PassthroughKind
Positioning
Positioning information - either a full Location with start/end or a single Position
SafeMode
Safe mode to use when processing the document. This follows from what is described in https://docs.asciidoctor.org/asciidoctor/latest/safe-modes/ and is intended to provide similar functionality as Asciidoctor.
Source
The source location for media content (images, audio, video).
StemNotation
Notation type for mathematical expressions.
Substitution
A Substitution represents a substitution in a passthrough macro.
VerticalAlignment
Vertical alignment for table cells

Constants§

ICON_SIZES

Functions§

inlines_to_string
Extract plain text from inline nodes, recursively handling formatted text.
parse
Parse AsciiDoc content from a string.
parse_file
Parse AsciiDoc content from a file.
parse_from_reader
Parse AsciiDoc content from a reader.
parse_inline
Parse inline AsciiDoc content from a string.

Type Aliases§

AttributeName
An AttributeName represents the name of an attribute in a document.
Role
Subtitle