Skip to content

Support .mmd (mermaid extension) and improve mermaid rendering #1893

Closed

Description

@3C0D

For all's convenience, please use English to fill this issue.

Is your feature request related to a problem? Please describe.
can't detect mmd extension files
And renders with mermaid (in md files) are far from perfect.
with P1[1. ATTENTION]
Image
text cut even if enough space in width
Image

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Activity

  1. added theissue type on Mar 18, 2026
  2. emako commented on Mar 18, 2026

    @emako
    Member

    Can you provide a .mmd file that renders exceptions?(or .md)

  3. emako commented on Mar 18, 2026

    @emako
    Member

    I'm not sure if the latest version of mermaid covers your needs.

    https://cdn.jsdelivr.net/npm/mermaid@11.13.0/dist/mermaid.min.js

  4. 3C0D commented on Mar 23, 2026

    @3C0D
    Author

    This explanation is insufficient for users of the MSI version. I’ve performed a deep search on my drive (using 'Everything'), and the mermaid.min.js file is nowhere to be found in the QuickLook installation folders.

    It seems the Markdown plugin is now directly integrated into the source files rather than being a standalone, modifiable package. Could you clarify how we are supposed to apply this update manually, or plan to include this fix in the next official release?

  5. 3C0D commented on Mar 23, 2026

    @3C0D
    Author

    Finally after a long fight, helped by claude sonnet 4.6
    yes this script solve the "Unsupported markdown: list" problem

    I can't use Visual Studio my disk is too small... So I used dnSpy. But impossible to find how to do it through the interface so Claude made me a script

    close outlook and dnSpy

    # ============================================================
    # Embed mermaid.min.js into QuickLook.Plugin.MarkdownViewer.dll
    # Fixes "Unsupported markdown: list" / mermaid diagrams not rendering
    # Requires: dnlib.dll (included with dnSpy)
    # Requires: mermaid.min.js (download from https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js)
    # ============================================================
    
    # --- Edit these paths ---
    $dnlibPath = "C:\Users\xxx\Downloads\dnSpy-net-win64\bin\dnlib.dll"
    $dllPath   = "C:\Users\xxx\AppData\Local\Programs\QuickLook\QuickLook.Plugin\QuickLook.Plugin.MarkdownViewer\QuickLook.Plugin.MarkdownViewer.dll"
    $jsPath    = "C:\Users\xxx\Desktop\mermaid.min.js"
    # ------------------------
    
    # Resource key expected by md2html.html (<script src="js/mermaid.min.js">)
    $resName = "QuickLook.Plugin.MarkdownViewer.Resources.js\mermaid.min.js"
    
    # Load dnlib (part of dnSpy) to manipulate the .NET assembly
    Add-Type -Path $dnlibPath
    
    $module  = [dnlib.DotNet.ModuleDefMD]::Load($dllPath)
    $jsBytes = [System.IO.File]::ReadAllBytes($jsPath)
    
    # Remove existing entry if present (e.g. when re-running the script)
    $existing = $module.Resources | Where-Object { $_.Name -eq $resName }
    if ($existing) { $module.Resources.Remove($existing) | Out-Null }
    
    # Embed mermaid.min.js as a binary resource inside the DLL
    $res = [dnlib.DotNet.EmbeddedResource]::new($resName, $jsBytes, [dnlib.DotNet.ManifestResourceAttributes]::Public)
    $module.Resources.Add($res)
    
    # Write to a temp file first to avoid file-lock issues, then replace
    $tmpPath = $dllPath + ".tmp"
    $module.Write($tmpPath)
    Move-Item -Force $tmpPath $dllPath
    
    Write-Host "Done."
    

    to run it

     & "C:\Users\xxx\Desktop\script.ps1" 2>&1 | Tee-Object -FilePath "C:\Users\xxx\Desktop\output.txt"
    

    I give the process if it can help someone else

  6. 3C0D commented on Mar 24, 2026

    @3C0D
    Author

    About the other issue: node labels truncated in mermaid diagrams
    When QuickLook opens, mermaid renders the diagram based on the initial window size. Node labels that exceed the box width get clipped and are not fully displayed. There is no scrollbar, and resizing the window to fullscreen does not trigger a re-render, so the truncated text stays as-is.
    A possible workaround could be to force a mermaid re-render when the window is resized or maximized, though this would require changes to md2html.html.

  7. added this to the 4.0.0 milestone on Mar 24, 2026
  8. emako commented on Mar 24, 2026

    @emako
    Member

    Do you have any suggestions for improving md2html.html?
    I don’t have any Mermaid code to reproduce this issue.

  9. emako commented on Mar 24, 2026

    @emako
    Member

    I update the mermaid.min.js after commit c23731d

  10. 3C0D commented on Mar 24, 2026

    @3C0D
    Author

    you ask to a llm to generate a mermaid example. claude chat is very good
    BTW, little detail, .mmd is not rendering mermaids.

  11. emako commented on Mar 24, 2026

    @emako
    Member

    issue-1893-mermaid.zip

    I said I can't reproduce it.

  12. 3C0D commented on Mar 24, 2026

    @3C0D
    Author

    ak ok (maximise the view to make the mermaid appear)
    raw code:

    graph TD
        subgraph Test_Bug
            direction TB
            Node1["1. PREMIER_ITEM"]
            Node1 -->|Lien A| SubNodeA["Détail A"]
            
            Node2["2. DEUXIEME_ITEM"]
            Node2 -->|Lien B| SubNodeB["Détail B"]
        end
    
        Start --> Node1
        Start --> Node2
    

    Mermaid with list items

    graph TD
        subgraph Test_Bug
            direction TB
            Node1["1. PREMIER_ITEM"]
            Node1 -->|Lien A| SubNodeA["Détail A"]
            
            Node2["2. DEUXIEME_ITEM"]
            Node2 -->|Lien B| SubNodeB["Détail B"]
        end
    
        Start --> Node1
        Start --> Node2
    
    Loading

    N.B:

    .mmd from your example → no render
    the other one → titles incomplete, \n not taken into account (still not supported with the last mermaid script you gave above)

    Image
  13. emako commented on Mar 27, 2026

    @emako
    Member

    These effects are consistent with the rendering effects of https://mermaid.live/

  14. 3C0D commented on Jul 26, 2026

    @3C0D
    Author

    @emako Hi. I saw the updates around this. We can see the problem is still there on Obsidian with num lists but something else is appearing in this picture a problem with color frame and arrow not visible. You can see the expected result lower behind

    Image
  15. emako commented on Jul 27, 2026

    @emako
    Member
  16. 3C0D commented on Jul 28, 2026

    @3C0D
    Author

    depending of the sun in room... 🤣 Well it's not invisible it's hardly visible

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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions