PhoenixStreamdown.Blocks (PhoenixStreamdown v1.0.0-beta.4)

Copy Markdown View Source

Splits markdown into independent blocks for incremental rendering.

Earlier blocks are stable — they won't change as new tokens arrive. Only the last block needs re-rendering on each update.

Summary

Functions

Splits markdown into a list of block strings.

Functions

parse(markdown)

@spec parse(String.t()) :: [String.t()]

Splits markdown into a list of block strings.

iex> PhoenixStreamdown.Blocks.parse("# Title\n\nParagraph one\n\nParagraph two")
["# Title", "Paragraph one", "Paragraph two"]