Module

PuduLangDocgen.Markdown.Layout

View source

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

text
Str

Returns

Int

View source

strip

fn strip(text: Str, columns: Int) -> Str

Text with up to the given columns of leading indentation removed.

Parameters

text
Str
columns
Int

Returns

Str

View source

blank

fn blank(text: Str) -> Bool

Whether a line holds only white space.

Parameters

text
Str

Returns

Bool

View source

fence

fn fence(text: Str) -> Option[Fence]

An opening fence of three or more backticks or tildes indented at most three columns.

Parameters

text
Str

Returns

Option[Fence]

View source

closes

fn closes(text: Str, opened: &Fence) -> Bool

Whether a line closes a fence: the same character, at least as long, nothing after it.

Parameters

text
Str
opened
&Fence

Returns

Bool

View source

thematic

fn thematic(text: Str) -> Bool

Whether a line is a thematic break of three or more -, *, or _.

Parameters

text
Str

Returns

Bool

View source

atx

fn atx(text: Str) -> Option[(Int, Str, Str)]

An ATX heading as level, content, and explicit {#id}.

Parameters

text
Str

Returns

Option[(Int, Str, Str)]

View source

setext

fn setext(text: Str) -> Int

The level of a setext underline: 1 for =, 2 for -, 0 for neither.

Parameters

text
Str

Returns

Int

View source

marker

fn marker(text: Str) -> Option[Marker]

A bullet or ordered list marker and the content column after it.

Parameters

text
Str

Returns

Option[Marker]

View source

quote

fn quote(text: Str) -> Option[Str]

The content of a block quote line without its > marker.

Parameters

text
Str

Returns

Option[Str]

View source

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

text
Str

Returns

Array[Str]

View source

alignments

fn alignments(text: Str) -> Option[Array[Str]]

Column alignments of a table delimiter row, or none when the line is not one.

Parameters

text
Str

Returns

Option[Array[Str]]

View source

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

text
Str

Returns

Bool

View source

interrupts

fn interrupts(text: Str) -> Bool

Whether a line ends a paragraph by starting another block.

Parameters

text
Str

Returns

Bool

View source

definition

fn definition(text: Str, number: Int) -> Option[(Str, Syntax.Target)]

A link reference definition [label]: destination "title".

Parameters

text
Str
number
Int

Returns

Option[(Str, Syntax.Target)]

View source

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])

View source

locate

fn locate(origin: Str, written: Str) -> Result[Str, Str]

The project-relative path a file names from the file that mentions it.

Parameters

origin
Str
written
Str

Returns

Result[Str, Str]

View source

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)]
count
Int

Returns

Array[Int]

View source