class Crst::Parser

Overview

Main parser class for reStructuredText documents

This class handles the parsing of RST text into an abstract syntax tree (AST) composed of Node objects. The parsing is done line by line, recognizing various RST constructs.

Example:

parser = Crst::Parser.new("Hello World")
doc = parser.parse

Defined in:

crst/parser.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(input : String, config : Config = Config.new) #

Initialize the parser with RST input text and configuration


[View source]

Instance Method Detail

def depth : Int32 #

[View source]
def depth=(depth : Int32) #

[View source]
def parse : Document #

Parse the input text and return the root Document node

Returns a Document containing all parsed nodes


[View source]
def parse_block(lines : Array(String), line_offset : Int32 = 0) : Array(Node) #

delegate to BlockParser


[View source]
def parse_directive(reader : LineReader, name : String, arguments : Array(String), line_offset : Int32) : Node #

delegate to DirectiveParser


[View source]
def parse_explicit_markup(reader : LineReader, line_offset : Int32) : Node #

delegate to ExplicitMarkupParser


[View source]
def section_levels : Array(Char) #

[View source]
def section_levels=(section_levels : Array(Char)) #

[View source]
def section_start?(reader : LineReader) : Bool #

delegate to SectionParser


[View source]
def try_parse_section(reader : LineReader, document : Document) : Bool #

[View source]