Skip to main content

Module render

Module render 

Source
Expand description

Markdown rendering adapters.

§Two output paths

  • to_ratatui_text — builds a ratatui::text::Text<'static> via tui-markdown. Paired with the TUI browser’s right-hand pane.
  • to_html_fragment / to_html_document — renders the same markdown body as minimal HTML for the embedded server’s response. Built on pulldown-cmark directly.

The in-house extras layer (tables, links rendered as underlined Spans, image-as-stub) lives here; tui-markdown handles the rest.

Functions§

resolve_link
Resolve a relative link inside the doc tree against root, going through a lexical safe_join check so ../../etc/passwd is rejected before hitting the asset layer.
text_into_owned
Deep-clone text so every span owns its string data. Used by the browser to cache the rendered body across event-loop ticks.
to_html_document
Render body as a full HTML document with a minimal stylesheet. Used by crate::DocsServer to emit the right response for GET /<page>.html.
to_html_fragment
Render body as a minimal HTML fragment (no surrounding <html> / <head>). Callers wrap in a full document.
to_plain_text
Strip markdown formatting and return a plain-text approximation of the body. Used for the tantivy full-text index.
to_ratatui_text
Render body into a ratatui::text::Text suitable for display inside a Paragraph widget. Delegates the paragraph / emphasis / code-fence path to tui-markdown.