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/slug.rb,
lib/red_quilt/tilt.rb,
lib/red_quilt/arena.rb,
lib/red_quilt/table.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/code_block.rb,
lib/red_quilt/diagnostic.rb,
lib/red_quilt/html_block.rb,
lib/red_quilt/plain_text.rb,
lib/red_quilt/source_map.rb,
lib/red_quilt/frontmatter.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/browser_launcher.rb,
lib/red_quilt/footnote_anchors.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/inline/url_sanitizer.rb,
lib/red_quilt/reference_definition.rb,
lib/red_quilt/extended_autolink_pass.rb,
lib/red_quilt/inline/emphasis_resolver.rb
Defined Under Namespace
Modules: Blockquote, CLI, CodeBlock, FootnoteAnchors, FootnoteDefinition, Frontmatter, HtmlBlock, Indentation, Inline, List, NodeType, PlainText, ReferenceDefinition, Renderer, Slug, Table, Theme
Classes: Arena, BlockParser, BrowserLauncher, Diagnostic, Document, Error, ExtendedAutolinkPass, FootnotePass, FootnoteRegistry, InlinePass, Line, LintPass, NodeRef, SourceMap, SourceSpan, TiltTemplate
Constant Summary
collapse
- VERSION =
"0.8.0"
Class Method Summary
collapse
-
.parse(source, allow_html: false, disallow_raw_html: false, extended_autolinks: false, footnotes: false, lint: false, frontmatter: false) ⇒ Object
-
.render_html(source, allow_html: false, disallow_raw_html: false, extended_autolinks: false, footnotes: false, lint: false, frontmatter: false, heading_ids: false, mermaid: false) ⇒ Object
Class Method Details
.parse(source, allow_html: false, disallow_raw_html: false, extended_autolinks: false, footnotes: false, lint: false, frontmatter: false) ⇒ Object
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
# File 'lib/red_quilt.rb', line 48
def parse(source, allow_html: false, disallow_raw_html: false, extended_autolinks: false, footnotes: false, lint: false, frontmatter: false)
normalized = normalize_input(source)
frontmatter_diagnostics = []
if frontmatter
frontmatter_data, normalized =
Frontmatter.(normalized, diagnostics: frontmatter_diagnostics)
end
arena = Arena.new(normalized)
= FootnoteRegistry.new if
block_parser = BlockParser.new(arena, footnotes: )
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: ,
frontmatter: frontmatter_data)
document.diagnostics.concat(frontmatter_diagnostics)
document.diagnostics.concat(block_parser.diagnostics)
InlinePass.new(document).apply
FootnotePass.new(document).apply if
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, frontmatter: false, heading_ids: false, mermaid: false) ⇒ Object
74
75
76
77
78
79
80
81
82
|
# File 'lib/red_quilt.rb', line 74
def render_html(source, allow_html: false, disallow_raw_html: false, extended_autolinks: false, footnotes: false, lint: false, frontmatter: false, heading_ids: false, mermaid: false)
parse(source,
allow_html: allow_html,
disallow_raw_html: disallow_raw_html,
extended_autolinks: extended_autolinks,
footnotes: ,
lint: lint,
frontmatter: frontmatter).to_html(heading_ids: heading_ids, mermaid: mermaid)
end
|