Template filter registration for Markdown rendering.
Provides a one-liner to register amarkdownfilter on a chirp App
so that templates can use{{ content | markdown }}.
markdown.filters
| Name | Type | Default | Description |
|---|---|---|---|
type
|
|
— | |
qualified_name
|
|
— | |
element_type
|
|
— | |
description
|
|
— | |
source_file
|
|
— | |
line_number
|
|
— | |
is_autodoc
|
|
— | |
autodoc_element
|
|
— | |
_autodoc_template
|
|
— | |
_autodoc_url_path
|
|
— | |
_autodoc_page_type
|
|
— | |
title
|
|
— | |
doc_content_hash
|
|
— |
Symbols on this page
register_markdown_filter
function
def register_markdown_filter(app: App, *, plugins: list[str] | None = None, highlight: bool = True, sanitize: bool = True, filter_name: str = 'markdown') -> MarkdownRenderer
Register amarkdowntemplate filter on the app.
Creates aMarkdownRenderer and registers its rendermethod
as a kida template filter. Returns the renderer so callers can
also use it directly (e.g., in route handlers).
Usage::
from chirp.markdown import register_markdown_filter
app = App()
md = register_markdown_filter(app)
# In templates: {{ content | markdown }}
# In code: html = md.render("# Hello")
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
app
|
App
|
— | The chirp application to register the filter on. |
plugins
|
list[str] | None
|
None
|
Patitas plugins to enable (default: all). |
highlight
|
bool
|
True
|
Enable syntax highlighting for fenced code blocks (default: True). |
sanitize
|
bool
|
True
|
Remove unsafe HTML and URL attributes (default: True). |
filter_name
|
str
|
'markdown'
|
Template filter name (default: ``"markdown"``). |
View source · /home/runner/work/chirp/chirp/site/../src/chirp/markdown/filters.py:1