Functions
determine_output_path
2
Path
▼
Determine the output path for a page.
Delegates path computation to centralize…
determine_output_path
2
Path
▼
def determine_output_path(page: PageLike, site: SiteLike) -> Path
Determine the output path for a page.
Delegates path computation to centralized URLStrategy (i18n-aware).
Parameters
| Name | Type | Description |
|---|---|---|
page |
PageLike |
Page to determine path for |
site |
SiteLike |
Site instance |
Returns
Path
determine_template
1
str
▼
Determine which template will be used for this page.
**Template resolution ord…
determine_template
1
str
▼
def determine_template(page: PageLike) -> str
Determine which template will be used for this page.
Template resolution order:
- page.template attribute
- page.metadata['template']
- Default based on page type
Parameters
| Name | Type | Description |
|---|---|---|
page |
PageLike |
Page object |
Returns
str
write_output
5
None
▼
Write rendered page to output directory.
**Handles:**
- Directory creation wit…
write_output
5
None
▼
def write_output(page: PageLike, site: SiteLike, collector: OutputCollector | None = None, write_behind: WriteBehindCollector | None = None, build_cache: Any = None) -> None
Write rendered page to output directory.
Handles:
- Directory creation with caching (reduces syscalls)
- Atomic writes for crash safety (optional)
- Fast writes for dev server performance
- Source→output tracking for incremental cleanup
- Output tracking for hot reload (when collector provided)
- Write-behind async I/O (when write_behind provided)
RFC: rfc-path-to-200-pgs (Phase III - Write-Behind I/O)
Parameters
| Name | Type | Description |
|---|---|---|
page |
PageLike |
Page with rendered content |
site |
SiteLike |
Site instance for config |
collector |
OutputCollector | None |
Optional output collector for hot reload tracking Default:None
|
write_behind |
WriteBehindCollector | None |
Optional write-behind collector for async writes Default:None
|
build_cache |
Any |
Optional BuildCache for direct cache access. Default:None
|
_copy_notebook_source
1
None
▼
Copy notebook .ipynb to output directory for download link.
_copy_notebook_source
1
None
▼
def _copy_notebook_source(page: PageLike) -> None
Parameters
| Name | Type | Description |
|---|---|---|
page |
PageLike |
_track_and_record
4
None
▼
Track output mapping and record output (shared by sync and async paths).
_track_and_record
4
None
▼
def _track_and_record(page: PageLike, site: SiteLike, collector: OutputCollector | None, build_cache: Any = None) -> None
Parameters
| Name | Type | Description |
|---|---|---|
page |
PageLike |
Page with output_path set |
site |
SiteLike |
Site instance |
collector |
OutputCollector | None |
Optional output collector for hot reload |
build_cache |
Any |
Optional BuildCache for direct cache access. Default:None
|
format_html
3
str
▼
Format HTML output (minify/pretty) with content hash embedding.
RFC: Output Ca…
format_html
3
str
▼
def format_html(html: str, page: PageLike, site: SiteLike) -> str
Format HTML output (minify/pretty) with content hash embedding.
RFC: Output Cache Architecture - Content hash is computed BEFORE formatting to ensure deterministic results. This enables accurate change detection.
RFC: rfc-build-performance-optimizations - fast_mode skips formatting entirely.
Respects page-level and site-level configuration:
- site.config.build.fast_mode: Skip formatting (highest priority)
- page.metadata.no_format: Skip formatting
- site.config.html_output.mode: 'minify', 'pretty', or 'raw'
- site.config.minify_html: Option
- site.config.build.content_hash_in_html: Embed content hash (default: true)
Parameters
| Name | Type | Description |
|---|---|---|
html |
str |
Rendered HTML content |
page |
PageLike |
Page being rendered |
site |
SiteLike |
Site instance for config |
Returns
str
embed_content_hash
2
str
▼
Embed content hash in HTML using safe template-aware insertion.
RFC: Output Ca…
embed_content_hash
2
str
▼
def embed_content_hash(html: str, content_hash: str | None = None) -> str
Embed content hash in HTML using safe template-aware insertion.
RFC: Output Cache Architecture - Embeds a content hash meta tag in the
section for accurate change detection during hot reload.Handles edge cases:
- Missing tag → skip embedding (don't break output)
- Uppercase/whitespace variants → normalize matching
- Already has hash → update existing
Parameters
| Name | Type | Description |
|---|---|---|
html |
str |
HTML content to embed hash into |
content_hash |
str | None |
Pre-computed hash (if None, computes from html) Default:None
|
Returns
str
extract_content_hash
1
str | None
▼
Extract content hash from HTML meta tag.
RFC: Output Cache Architecture - Extr…
extract_content_hash
1
str | None
▼
def extract_content_hash(html: str) -> str | None
Extract content hash from HTML meta tag.
RFC: Output Cache Architecture - Extracts embedded content hash for comparison during hot reload change detection.
Returns None if no hash found (old/external content). Handles case-insensitive matching and attribute order variations.
Parameters
| Name | Type | Description |
|---|---|---|
html |
str |
HTML content to extract hash from |
Returns
str | None