Functions
normalize_page_type_to_content_type
Normalize a page type to a content type.
Handles special cases where page types (from frontmatter)…
normalize_page_type_to_content_type
def normalize_page_type_to_content_type(page_type: str) -> str | None
Normalize a page type to a content type.
Handles special cases where page types (from frontmatter) map to content types:
- python-module -> api-reference
- cli-command -> cli-reference
- Other types pass through if registered
Parameters 1
| Name | Type | Default | Description |
|---|---|---|---|
page_type |
str |
— | Page type from frontmatter (e.g., "python-module", "blog") |
Returns
Content type name if recognized, None otherwisestr | None
—
get_strategy
Get the strategy for a content type.
get_strategy
def get_strategy(content_type: str) -> ContentTypeStrategy
Get the strategy for a content type.
Parameters 1
| Name | Type | Default | Description |
|---|---|---|---|
content_type |
str |
— | Type name (e.g., "blog", "doc", "api-reference") |
Returns
ContentTypeStrategy instanceContentTypeStrategy
—
detect_content_type
Auto-detect content type from section characteristics.
Uses heuristics from each strategy to deter…
detect_content_type
def detect_content_type(section: Section, config: dict[str, Any] | None = None) -> str
Auto-detect content type from section characteristics.
Uses heuristics from each strategy to determine the best type.
Priority order:
- Explicit type in section metadata
- Cascaded type from parent section
- Auto-detection via strategy heuristics
- Config-based default (content.default_type or site.default_content_type)
- Default to "list"
Parameters 2
| Name | Type | Default | Description |
|---|---|---|---|
section |
Section |
— | Section to analyze |
config |
dict[str, Any] | None |
None |
Optional site config for default_content_type lookup |
Returns
Content type namestr
—
register_strategy
Register a custom content type strategy.
Allows users to add their own content types.
register_strategy
def register_strategy(content_type: str, strategy: ContentTypeStrategy) -> None
Register a custom content type strategy.
Allows users to add their own content types.
Parameters 2
| Name | Type | Default | Description |
|---|---|---|---|
content_type |
str |
— | Type name |
strategy |
ContentTypeStrategy |
— | Strategy instance |