module

CRDoc::Render::Inline

Inline Markdown parsing and word wrapping.

Class methods

parse(text : String) : Array(Piece)

Parses inline Markdown into styled pieces. Links keep their text, images keep their alt text, and HTML tags disappear.

Source
plain(text : String) : String

Plain text of pieces with all styling dropped.

Source
truncate(pieces : Array(Piece), limit : Int32) : Array(Piece)

Cuts pieces to limit characters, ending with … when it cuts.

Source
unescape(text : String) : String

Decodes only the entities that doc comments use for markup characters. Full HTML5 decoding would turn &block into a block character.

Source
width(word : Array(Piece)) : Int32
Source
words(pieces : Array(Piece)) : Array(Array(Piece))

Splits pieces into unbreakable words. Code spans never split.

Source
wrap(words : Array(Array(Piece)), io : IO, context : Context, first_prefix : String, rest_prefix : String, base : Style = Style::Plain, lead_style : Style = Style::Plain) : Nil

Writes words wrapped to the context width. The first line starts with first_prefix (styled lead_style) and later lines with rest_prefix. Plain pieces take base style.

Source
write_word(word : Array(Piece), io : IO, context : Context, base : Style) : Nil
Source