Markdown¶
Render Markdown through the optional, escaped content pipeline.
| Import | from hedron import Markdown |
| Distribution | hedron[markdown] |
| Backend activity | No |
| Normal render mode | RenderMode.FRAGMENT |
Live demo¶
Release notes
- Safer URLs
- Faster rendering
Generated from Markdown source.
The preview is a local docs simulation (not a running Hedron server). Interactive demos show a “Simulated HTMX” trace when applicable.
Install the optional provider before importing this component:
Basic use¶
from hedron import Markdown
component = Markdown("## Release notes\n\n- Safer URLs\n- Faster rendering")
Compose under Page for full documents, or return from a fragment route for HTMX swaps.
How it works¶
Markdown uses the optional markdown dependency and returns reviewed rendered output. Raw HTML handling and sanitization are governed by the content pipeline; it is not a shortcut around TrustedHtml.
This component's core behavior is server-rendered HTML and does not require a browser runtime. The preview is ordinary semantic HTML, so keyboard, form, link, and disclosure behavior comes from the platform.
Constructor and parameters¶
| Parameter | Type | Meaning |
|---|---|---|
source |
str |
Markdown source text. |
Composition and backend behavior¶
Keep Markdown at the smallest semantic boundary. Fragment routes should return only
the replaced region and preserve stable target IDs across success, validation, empty,
loading, and error responses.
This component is primarily presentational; keep any mutation on an explicit action or component route.
Accessibility¶
Authors still own heading hierarchy, meaningful link text, table captions, and image alternatives in the source.
Security¶
Escaping and SafeUrl / TrustedHtml are framework concerns; authorization and data
exposure remain application code. Redact secrets before rendering.
Common mistakes¶
- Install
hedron[markdown]and never assume arbitrary embedded HTML is trusted. - Do not copy docs-preview JavaScript into an application server.