Functions
parse_frontmatter
1
tuple[dict[str, object],…
▼
Split frontmatter from markdown body.
parse_frontmatter
1
tuple[dict[str, object],…
▼
def parse_frontmatter(text: str) -> tuple[dict[str, object], str]
Parameters
| Name | Type | Description |
|---|---|---|
text |
str |
Returns
tuple[dict[str, object], str]
_parse_simple
1
dict[str, object]
▼
Minimal key: value parser when PyYAML is unavailable.
_parse_simple
1
dict[str, object]
▼
def _parse_simple(raw: str) -> dict[str, object]
Parameters
| Name | Type | Description |
|---|---|---|
raw |
str |
Returns
dict[str, object]
_meta_from_dict
1
DocMetadata
▼
Build a ``DocMetadata`` from a parsed frontmatter dict.
_meta_from_dict
1
DocMetadata
▼
def _meta_from_dict(d: dict[str, object]) -> DocMetadata
Parameters
| Name | Type | Description |
|---|---|---|
d |
dict[str, object] |
Returns
DocMetadata
_title_from_body
1
str
▼
Extract title from first markdown heading, or return empty string.
_title_from_body
1
str
▼
def _title_from_body(body: str) -> str
Parameters
| Name | Type | Description |
|---|---|---|
body |
str |
Returns
str
_extract_toc
1
tuple[TocEntry, ...]
▼
Extract table-of-contents entries from rendered HTML headings.
_extract_toc
1
tuple[TocEntry, ...]
▼
def _extract_toc(html: str) -> tuple[TocEntry, ...]
Parameters
| Name | Type | Description |
|---|---|---|
html |
str |
Returns
tuple[TocEntry, ...]
_slug_to_identifier
1
str
▼
Convert kebab-case (or arbitrary text) to a snake_case Python identifier.
Kida…
_slug_to_identifier
1
str
▼
def _slug_to_identifier(s: str) -> str
Convert kebab-case (or arbitrary text) to a snake_case Python identifier.
Kida block names must be valid Python identifiers, while heading ids
emitted by patitas are kebab-case (section-overview).
Parameters
| Name | Type | Description |
|---|---|---|
s |
str |
Returns
str
_split_blocks
1
tuple[DocBlock, ...]
▼
Split rendered HTML into sections at H2 (or H3 fallback) boundaries.
Content b…
_split_blocks
1
tuple[DocBlock, ...]
▼
def _split_blocks(html: str) -> tuple[DocBlock, ...]
Split rendered HTML into sections at H2 (or H3 fallback) boundaries.
Content before the first heading becomes a synthesizedintroblock
(depth=0, empty heading/anchor). Duplicate ids are
disambiguated with a numeric suffix.
Parameters
| Name | Type | Description |
|---|---|---|
html |
str |
Returns
tuple[DocBlock, ...]
_slug_from_path
2
str
▼
Derive a URL slug from a file path relative to content_dir.
Index-like files b…
_slug_from_path
2
str
▼
def _slug_from_path(md_path: Path, content_dir: Path) -> str
Derive a URL slug from a file path relative to content_dir.
Index-like files become the parent directory slug:
content_dir/guides/getting-started.md → guides/getting-started
content_dir/guides/index.md → guides
content_dir/guides/_index.md → guides
content_dir/guides/README.md → guides
content_dir/index.md → index
content_dir/_index.md → index
Parameters
| Name | Type | Description |
|---|---|---|
md_path |
Path |
|
content_dir |
Path |
Returns
str
parse_file
2
DocPage
▼
Parse a single markdown file into a ``DocPage``.
Reads the file, splits frontm…
parse_file
2
DocPage
▼
def parse_file(md_path: Path, content_dir: Path) -> DocPage
Parse a single markdown file into aDocPage.
Reads the file, splits frontmatter, renders markdown via
MarkdownRenderer, and extracts TOC entries.
Parameters
| Name | Type | Description |
|---|---|---|
md_path |
Path |
|
content_dir |
Path |
Returns
DocPage