Skip to content

DOCX Mermaid diagrams fall back to code in macOS releases #59

Closed

Description

@aniongithub

Description

DOCX exports produced by an installed macOS release render Mermaid fenced blocks as source-code fallbacks instead of embedded diagram images.

This was found after the DOCX export implementation landed in #58.

DOCX export showing Mermaid source instead of a rendered image

Root cause

Release builds embed webui/dist, but Mermaid rendering currently searches for a standalone bundle only in development or sidecar locations such as webui/node_modules/mermaid/dist/mermaid.min.js and mermaid.min.js next to the executable. A normal macOS release contains neither, so findMermaidJS() fails and the DOCX exporter deliberately falls back to a code block.

Browser discovery can also fail when Chrome-family browsers are installed under ~/Applications, because only system /Applications paths and $PATH are checked.

Expected behavior

  • Copy a standalone mermaid.min.js into webui/dist during the WebUI build.
  • Include it in the existing embedded WebUI filesystem used by release binaries.
  • Load the embedded Mermaid bundle for PDF and DOCX rendering rather than requiring node_modules or a sidecar file.
  • Preserve development-path fallbacks where useful.
  • Discover supported macOS browsers in both /Applications and ~/Applications.
  • Add tests covering embedded Mermaid discovery and macOS browser candidate construction.

Actual behavior

The exporter logs docx: Mermaid render failed; using code fallback, commonly with mermaid.min.js not found, and writes the Mermaid definition as a highlighted code block.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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