Module

PuduLangDocgen.Markdown.Snippet

View source

Code excerpts selected by region, range, and emphasis

Types

Name Description
Selection Which lines of a source file an excerpt shows

Functions

Name Description
selection The file path and selection written in an excerpt destination. `#name` selects a region, `#L3-L9` a line range; `?name=`, `?range=`, `?highlight=` and `?dedent=` refine it.
ranges Line ranges written as `3`, `3-9`, or `12-`, separated by commas.
extract The excerpt a selection takes from file text and the output lines it emphasizes. Region markers inside the excerpt are removed; common indentation is removed unless `dedent` names an exact amount.

selection

fn selection(destination: Str) -> Result[Selection, Str]

The file path and selection written in an excerpt destination. #name selects a region, #L3-L9 a line range; ?name=, ?range=, ?highlight= and ?dedent= refine it.

Parameters

destination
Str

Returns

Result[Selection, Str]

View source

ranges

fn ranges(written: Str) -> Result[Array[(Int, Int)], Str]

Line ranges written as 3, 3-9, or 12-, separated by commas.

Parameters

written
Str

Returns

Result[Array[(Int, Int)], Str]

View source

extract

fn extract(text: Str, chosen: &Selection) -> Result[(Str, Array[Int]), Str]

The excerpt a selection takes from file text and the output lines it emphasizes. Region markers inside the excerpt are removed; common indentation is removed unless dedent names an exact amount.

Parameters

text
Str
chosen
&Selection

Returns

Result[(Str, Array[Int]), Str]

View source