Skip to main content

render_markdown

Function render_markdown 

Source
pub fn render_markdown(
    content: &str,
    highlighter: &Highlighter,
    base_path: &str,
    page_url: &str,
    link_base_url: &str,
) -> Result<String>
Expand description

Render markdown content to HTML with syntax-highlighted code blocks. Root-absolute internal links are prefixed with base_path, and relative links are resolved from link_base_url.

page_url is the current page’s canonical URL path (base-prefixed, with a trailing slash — e.g. /webui/guide/). In-page fragment links (heading anchors and [text](#section) links) are emitted as absolute paths ({page_url}#slug) rather than bare #slug. A bare fragment would resolve against the document’s <base href> — which points at the site root — and navigate away from the current page instead of scrolling within it.

link_base_url is the URL directory corresponding to the Markdown source file. It can differ from page_url when configuration overrides the route.