patinas-docs-render
Markdown to HTML for the Patinas documentation surfaces, and the bundle format they are delivered in.
Why this exists as a crate
Two surfaces render the same cleared Markdown with different chrome:
apps/patinas-sitegenerates the public docs portal as static HTML.apps/patinas-viewerserves the tenant console.
They must agree about URLs. If each implemented link rewriting itself, a page could work on one surface and 404 on the other, and the difference would only show up in production. This crate owns the part they must not implement twice: URL policy, link rewriting, and Markdown to HTML. It knows nothing about a theme, so the surfaces can look different while resolving links identically.
What it does
slugifyandurl_fordefine the site URL for a repository-relative path.asset_url_forkeeps assets at their repository path.resolve_linkrewrites one relative destination to a site URL, returningNonefor anything that leaves the site.render_documentreturns an HTML fragment, the page title, and the headings with generated anchor ids.
Two behaviours are worth knowing:
- Internal links become absolute. The site export preserves repository paths, so a link is correct relative to the Markdown tree and wrong relative to the rendered tree. Rewriting to absolute URLs removes the class of bug where a page works at one depth and fails at another.
mermaidfences become<pre class="mermaid">. With rendering off, or with no renderer loaded, the diagram source is still shown in a styled block rather than nothing.
Licensing
Proprietary. See the repository NOTICE.