Module

PuduLangDocgen.Navigation

View source

Table of contents files read into nested items

Types

Name Description
Toc Items of one table of contents with its own metadata

Functions

Name Description
isToc Whether a project-relative path names a table of contents file.
parse A table of contents written as YAML, JSON, or Markdown headings. An object form holds `items` beside metadata such as `order` or `pdf`. Hrefs are kept as written; resolution happens against the published docset.
markdown Items of a Markdown table of contents: each heading level nests one deeper. `# [Title](href)` links an item; `# Title` makes a group.
forPages Items for published pages when no table of contents exists, ordered by path.
toJson Items as JSON with `name`, `href`, `expanded`, and nested `items`.

isToc

fn isToc(path: Str) -> Bool

Whether a project-relative path names a table of contents file.

Parameters

path
Str

Returns

Bool

View source

parse

fn parse(path: Str, text: Str) -> Result[Toc, Array[Docgen.Diagnostic]]

A table of contents written as YAML, JSON, or Markdown headings. An object form holds items beside metadata such as order or pdf. Hrefs are kept as written; resolution happens against the published docset.

Parameters

path
Str
text
Str

Returns

Result[Toc, Array[Docgen.Diagnostic]]

View source

markdown

fn markdown(path: Str, text: Str) -> Result[Array[Docgen.TocItem], Array[Docgen.Diagnostic]]

Items of a Markdown table of contents: each heading level nests one deeper. # [Title](href) links an item; # Title makes a group.

Parameters

path
Str
text
Str

Returns

Result[Array[Docgen.TocItem], Array[Docgen.Diagnostic]]

View source

forPages

fn forPages(pages: &Array[Docgen.Page]) -> Array[Docgen.TocItem]

Items for published pages when no table of contents exists, ordered by path.

Parameters

pages
&Array[Docgen.Page]

Returns

Array[Docgen.TocItem]

View source

toJson

fn toJson(tree: &Array[Docgen.TocItem]) -> Json.Json

Items as JSON with name, href, expanded, and nested items.

Parameters

tree
&Array[Docgen.TocItem]

Returns

Json.Json

View source