Module
PuduLangDocgen.Markdown.Layout
Line-level recognition of block boundaries
Types
| Name | Description |
|---|---|
Fence |
An opening code fence and its info text |
Marker |
A list item marker and the content after it |
Functions
| Name | Description |
|---|---|
indent |
Leading indentation in columns, with tabs advancing to the next multiple of four. |
strip |
Text with up to the given columns of leading indentation removed. |
blank |
Whether a line holds only white space. |
fence |
An opening fence of three or more backticks or tildes indented at most three columns. |
closes |
Whether a line closes a fence: the same character, at least as long, nothing after it. |
thematic |
Whether a line is a thematic break of three or more `-`, `*`, or `_`. |
atx |
An ATX heading as level, content, and explicit `{#id}`. |
setext |
The level of a setext underline: 1 for `=`, 2 for `-`, 0 for neither. |
marker |
A bullet or ordered list marker and the content column after it. |
quote |
The content of a block quote line without its `>` marker. |
cells |
Cells of a pipe table row; escaped pipes and pipes inside code spans stay in their cell. |
alignments |
Column alignments of a table delimiter row, or none when the line is not one. |
html |
Whether a line opens an HTML block: a comment, a block-level element, or a line holding exactly one tag. |
interrupts |
Whether a line ends a paragraph by starting another block. |
definition |
A link reference definition `[label]: destination "title"`. |
definitions |
Link reference definitions outside code, and the lines that remain. |
locate |
The project-relative path a file names from the file that mentions it. |
expand |
Line numbers of ranges limited to the lines a sample has. |
indent
fn indent(text: Str) -> Int
Leading indentation in columns, with tabs advancing to the next multiple of four.
Parameters
textStr
Returns
Int
strip
fn strip(text: Str, columns: Int) -> Str
Text with up to the given columns of leading indentation removed.
Parameters
textStrcolumnsInt
Returns
Str
blank
fn blank(text: Str) -> Bool
Whether a line holds only white space.
Parameters
textStr
Returns
Bool
fence
An opening fence of three or more backticks or tildes indented at most three columns.
Parameters
textStr
Returns
Option[Fence]
closes
Whether a line closes a fence: the same character, at least as long, nothing after it.
Parameters
textStropened&Fence
Returns
Bool
thematic
fn thematic(text: Str) -> Bool
Whether a line is a thematic break of three or more -, *, or _.
Parameters
textStr
Returns
Bool
atx
fn atx(text: Str) -> Option[(Int, Str, Str)]
An ATX heading as level, content, and explicit {#id}.
Parameters
textStr
Returns
Option[(Int, Str, Str)]
setext
fn setext(text: Str) -> Int
The level of a setext underline: 1 for =, 2 for -, 0 for neither.
Parameters
textStr
Returns
Int
marker
A bullet or ordered list marker and the content column after it.
Parameters
textStr
Returns
Option[Marker]
quote
fn quote(text: Str) -> Option[Str]
The content of a block quote line without its > marker.
Parameters
textStr
Returns
Option[Str]
cells
fn cells(text: Str) -> Array[Str]
Cells of a pipe table row; escaped pipes and pipes inside code spans stay in their cell.
Parameters
textStr
Returns
Array[Str]
alignments
fn alignments(text: Str) -> Option[Array[Str]]
Column alignments of a table delimiter row, or none when the line is not one.
Parameters
textStr
Returns
Option[Array[Str]]
html
fn html(text: Str) -> Bool
Whether a line opens an HTML block: a comment, a block-level element, or a line holding exactly one tag.
Parameters
textStr
Returns
Bool
interrupts
fn interrupts(text: Str) -> Bool
Whether a line ends a paragraph by starting another block.
Parameters
textStr
Returns
Bool
definition
fn definition(text: Str, number: Int) -> Option[(Str, Syntax.Target)]
A link reference definition [label]: destination "title".
Parameters
textStrnumberInt
Returns
Option[(Str, Syntax.Target)]
definitions
fn definitions(lines: &Array[FrontMatter.Line]) -> (Map[Str, Syntax.Target], Array[FrontMatter.Line])
Link reference definitions outside code, and the lines that remain.
Parameters
lines&Array[FrontMatter.Line]
Returns
(Map[Str, Syntax.Target], Array[FrontMatter.Line])
locate
fn locate(origin: Str, written: Str) -> Result[Str, Str]
The project-relative path a file names from the file that mentions it.
Parameters
originStrwrittenStr
Returns
Result[Str, Str]
expand
fn expand(bounds: &Array[(Int, Int)], count: Int) -> Array[Int]
Line numbers of ranges limited to the lines a sample has.
Parameters
bounds&Array[(Int, Int)]countInt
Returns
Array[Int]