Module: RedQuilt

Defined in:
lib/red_quilt.rb,
lib/red_quilt/cli.rb,
lib/red_quilt/line.rb,
lib/red_quilt/list.rb,
lib/red_quilt/arena.rb,
lib/red_quilt/theme.rb,
lib/red_quilt/inline.rb,
lib/red_quilt/version.rb,
lib/red_quilt/document.rb,
lib/red_quilt/node_ref.rb,
lib/red_quilt/lint_pass.rb,
lib/red_quilt/node_type.rb,
lib/red_quilt/blockquote.rb,
lib/red_quilt/diagnostic.rb,
lib/red_quilt/plain_text.rb,
lib/red_quilt/source_map.rb,
lib/red_quilt/indentation.rb,
lib/red_quilt/inline_pass.rb,
lib/red_quilt/source_span.rb,
lib/red_quilt/block_parser.rb,
lib/red_quilt/inline/lexer.rb,
lib/red_quilt/footnote_pass.rb,
lib/red_quilt/inline/tokens.rb,
lib/red_quilt/renderer/html.rb,
lib/red_quilt/inline/builder.rb,
lib/red_quilt/renderer/mdast.rb,
lib/red_quilt/inline/flanking.rb,
lib/red_quilt/footnote_registry.rb,
lib/red_quilt/inline/token_kind.rb,
lib/red_quilt/footnote_definition.rb,
lib/red_quilt/inline/link_scanner.rb,
lib/red_quilt/inline/html_entities.rb,
lib/red_quilt/reference_definition.rb,
lib/red_quilt/extended_autolink_pass.rb

Defined Under Namespace

Modules: Blockquote, CLI, FootnoteDefinition, Indentation, Inline, List, NodeType, PlainText, ReferenceDefinition, Renderer, Theme Classes: Arena, BlockParser, Diagnostic, Document, Error, ExtendedAutolinkPass, FootnotePass, FootnoteRegistry, InlinePass, Line, LintPass, NodeRef, SourceMap, SourceSpan

Constant Summary collapse

VERSION =
"0.6.1"

Class Method Summary collapse

Class Method Details

.parse(source, allow_html: false, disallow_raw_html: false, extended_autolinks: false, footnotes: false, lint: false) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/red_quilt.rb', line 40

def parse(source, allow_html: false, disallow_raw_html: false, extended_autolinks: false, footnotes: false, lint: false)
  normalized = normalize_input(source)
  arena = Arena.new(normalized)
  footnote_registry = FootnoteRegistry.new if footnotes
  block_parser = BlockParser.new(arena, footnotes: footnote_registry)
  root_id = block_parser.parse
  document = Document.new(normalized, arena, root_id,
                          allow_html: allow_html,
                          disallow_raw_html: disallow_raw_html,
                          references: block_parser.references,
                          footnotes: footnote_registry)
  document.diagnostics.concat(block_parser.diagnostics)
  InlinePass.new(document).apply
  FootnotePass.new(document).apply if footnote_registry
  ExtendedAutolinkPass.new(document).apply if extended_autolinks
  LintPass.new(document).apply if lint
  document
end

.render_html(source, allow_html: false, disallow_raw_html: false, extended_autolinks: false, footnotes: false, lint: false) ⇒ Object



59
60
61
62
63
64
65
66
# File 'lib/red_quilt.rb', line 59

def render_html(source, allow_html: false, disallow_raw_html: false, extended_autolinks: false, footnotes: false, lint: false)
  parse(source,
        allow_html: allow_html,
        disallow_raw_html: disallow_raw_html,
        extended_autolinks: extended_autolinks,
        footnotes: footnotes,
        lint: lint).to_html
end