Skip to content

Render Mermaid fenced code blocks in the viewer and HTML exports #14

Description

@davidmoshal

Problem

OpenKnowledge 0.8.4 recognizes fenced mermaid blocks, but openknowledge view displays the Mermaid source as an ordinary code block instead of rendering a diagram.

Reproduction

  1. Add a Mermaid fence to a knowledge-base document:
flowchart LR
  A --> B
Loading
  1. Run openknowledge view <knowledge-base>.
  2. Open the document.

Observed behavior

The viewer emits:

<pre class="code-block language-mermaid" data-language="mermaid">

and displays the source text. No Mermaid runtime is loaded.

Expected behavior

Mermaid fences render as diagrams in:

  • the initial viewer panel;
  • dynamically opened stacked panels;
  • the default interactive HTML export.

Invalid Mermaid should retain a readable source fallback and expose a useful error without breaking the rest of the document.

Rendering should work offline from same-origin assets and use Mermaid’s strict security mode.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions