module Luce

Overview

Parses text in a Markdown-like format building an AST tree that can then be rendered to HTML.

If you are only interested in rendering Markdown to HTML, please refer to the README which explains the use of Luce.to_html.

The main entrypoint to the library is the Document which encapsulates the parsing process converting a Markdown text into a tree of Node (Array(Node)).

Two main parsing mechanics are used:

Looking closely at Document.new() a few other concepts merit a mention:

If you are looking at extending the library to support custom formatting what you may want is to:

Defined in:

luce.cr
luce/ast.cr
luce/block_parser.cr
luce/document.cr
luce/emojis.cr
luce/extension_set.cr
luce/html_renderer.cr
luce/inline_parser.cr
luce/util.cr

Constant Summary

VERSION = "0.2.0"

Class Method Summary

Class Method Detail

def self.render_html(nodes : Array(Node)) : String #

Render nodes to HTML.


def self.to_html(markdown : String, block_syntaxes = Array(BlockSyntax).new, inline_syntaxes = Array(InlineSyntax).new, extension_set : ExtensionSet | Nil = nil, link_resolver : Resolver | Nil = nil, image_link_resolver : Resolver | Nil = nil, inline_only : Bool = false, encode_html : Bool = true, with_default_block_syntaxes : Bool = true, with_default_inline_syntaxes : Bool = true) : String #

Converts the given string of Markdown to HTML