class BBS::Markdown::Renderer
Turns the source lines of a Markdown text into terminal lines, a block at a time: each block kind is a method that looks at the line, and when the line starts its block, writes the block and returns how many source lines it took. A line no block takes joins the paragraph.
Constants
- BLOCKS
-
The block kinds in the order they are tried.
- HEADINGS
-
The style of each heading level; deeper levels take
:h3.
Public Class Methods
Source
# File lib/bbs/markdown/renderer.rb, line 17 def initialize(width, styles) @width = width @styles = styles end
A renderer for lines width columns wide in styles (see Markdown::STYLE_ROLES).
Public Instance Methods
Source
# File lib/bbs/markdown/renderer.rb, line 23 def render(lines) @lines = lines @out = [] @paragraph = [] @code = false index = 0 index += step(index) while index < lines.size flush @out end
The terminal lines of the source lines, an Array of String.