Skip to content

Address issue #35: Upgrade Mermaid to v11.12.1 for flowchart rendering#262

Merged
schuyler merged 5 commits intomainfrom
claude/resolve-pr-193-conflicts-NvsRh
Jan 10, 2026
Merged

Address issue #35: Upgrade Mermaid to v11.12.1 for flowchart rendering#262
schuyler merged 5 commits intomainfrom
claude/resolve-pr-193-conflicts-NvsRh

Conversation

@schuyler
Copy link
Copy Markdown
Owner

Summary

This PR supersedes #193 with merge conflicts resolved.

  • Upgrade Mermaid library from v8.4.3 (2020) to v11.12.1
  • Update mermaid.init.js to use Promise-based API (Mermaid 10.x+)
  • Add async/await pattern for rendering with proper error handling
  • Add unique ID generation to prevent collisions on document re-renders
  • Add securityLevel: 'loose' and logLevel: 'error' to configuration
  • Update documentation to reflect Mermaid 11.x

Related Issue

Related to #35
Supersedes #193

Manual Testing Plan

A comprehensive 16-test manual testing plan was created covering:

  • Basic flowchart rendering (graph TD, LR, BT, RL)
  • Decision nodes, subgraphs, styled nodes, long text labels
  • Error handling for malformed syntax
  • Multiple diagrams without ID collisions
  • Live preview re-rendering
  • Regression testing for gantt charts (issue Mermaid issue on latest release 0.8.0d71 #18)
  • Regression testing for other diagram types (sequence, class, state, pie)
  • HTML export verification
  • Unicode/emoji support
  • Performance with large diagrams

Review Notes

  • Groucho (Architect): Identified mermaid.min.js and mermaid.init.js as the key files
  • Chico (Code Review): Approved with one fix for ID collisions (addressed)
  • Harpo (Documentation): Updated MANUAL_TEST_PLAN_ISSUE_18.md
  • Zeppo (Testing): Created comprehensive 16-test manual testing plan

claude added 4 commits January 8, 2026 16:11
- Upgrade Mermaid library from v8.4.3 to v11.12.1
- Update mermaid.init.js to use Promise-based API (Mermaid 10.x+)
- Add async/await pattern for rendering calls
- Add error handling with user-visible error messages
- Add securityLevel: 'loose' for cross-origin rendering support

The previous version (8.4.3 from 2020) had issues rendering flowchart
diagrams with the graph TD syntax. The new version should resolve
these rendering issues.

Related to #35
- Add unique ID generation to prevent collisions on re-renders
- Add check for mermaid library being loaded before initialization
- Add logLevel: 'error' to suppress verbose console logging
- Improve error message styling with padding and background

Related to #35
Updated MANUAL_TEST_PLAN_ISSUE_18.md to reference the new Mermaid 11.x
Promise-based API instead of the older Mermaid 8.0+ version.

Related to #35
Merges recent changes from main including:
- Bidirectional scroll sync (preview to editor)
- CHANGELOG updates for version 3000.0.3
- Lists immediately after paragraphs fix
- Plan files review and updates

Related to #35
Using 'loose' could allow XSS attacks when opening untrusted
Markdown files containing malicious Mermaid diagrams. The
'antiscript' level still allows HTML formatting in labels but
strips <script> tags for better security.

Related to #35
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 10, 2026

Code Coverage Report

Current Coverage: 51.68%

Coverage Details (Summary)
Name                                                                                                                                   Coverage            
-------------------------------------------------------------------------------------------------------------------------------------- ------------------- 
MASPreferences.bundle                                                                                                                  0.00% (0/0)         
MacDown 3000.app                                                                                                                       58.00% (7338/12652) 
    /Users/runner/work/macdown3000/macdown3000/MacDown/Code/Extension/NSColor+HTML.m                                                   94.05% (332/353)    
        +[NSColor(HTML) colorWithHexString:]                                                                                           94.12% (16/17)      
        +[NSColor(HTML) colorWithHTMLName:]                                                                                            89.13% (164/184)    
        __35+[NSColor(HTML) colorWithHTMLName:]_block_invoke                                                                           100.00% (152/152)   
    /Users/runner/work/macdown3000/macdown3000/Dependency/peg-markdown-highlight/HGMarkdownHighlighter.m                               81.75% (457/559)    
        styleparsing_error_callback                                                                                                    90.00% (9/10)       
        -[HGMarkdownHighlighter init]                                                                                                  92.86% (13/14)      
        -[HGMarkdownHighlighter initWithTextView:]                                                                                     83.33% (5/6)        
        -[HGMarkdownHighlighter initWithTextView:waitInterval:]                                                                        83.33% (5/6)        
        -[HGMarkdownHighlighter initWithTextView:waitInterval:styles:]                                                                 83.33% (5/6)        
        -[HGMarkdownHighlighter parseText:]                                                                                            100.00% (9/9)       
        -[HGMarkdownHighlighter convertOffsets:text:]                                                                                  26.19% (11/42)      
        -[HGMarkdownHighlighter requestParsing]                                                                                        100.00% (15/15)     
        __39-[HGMarkdownHighlighter requestParsing]_block_invoke                                                                       100.00% (12/12)     
        __39-[HGMarkdownHighlighter requestParsing]_block_invoke.55                                                                    100.00% (3/3)       
        __39-[HGMarkdownHighlighter requestParsing]_block_invoke.67                                                                    100.00% (4/4)       
        -[HGMarkdownHighlighter getClearFontTraitMask:]                                                                                88.89% (16/18)      
        -[HGMarkdownHighlighter clearHighlightingForRange:]                                                                            100.00% (31/31)     
        __51-[HGMarkdownHighlighter clearHighlightingForRange:]_block_invoke                                                           100.00% (8/8)       
        -[HGMarkdownHighlighter readClearTextStylesFromTextView]                                                                       100.00% (17/17)     
        -[HGMarkdownHighlighter applyHighlighting:withRange:]                                                                          74.67% (56/75)      
        __53-[HGMarkdownHighlighter applyHighlighting:withRange:]_block_invoke                                                         92.31% (12/13)      
        -[HGMarkdownHighlighter applyVisibleRangeHighlighting]                                                                         100.00% (16/16)     
        -[HGMarkdownHighlighter clearHighlighting]                                                                                     100.00% (3/3)       
        -[HGMarkdownHighlighter cacheElementList:]                                                                                     100.00% (6/6)       
        -[HGMarkdownHighlighter clearElementsCache]                                                                                    100.00% (2/2)       
        -[HGMarkdownHighlighter textViewTextDidChange:]                                                                                0.00% (0/11)        
        __47-[HGMarkdownHighlighter textViewTextDidChange:]_block_invoke                                                               0.00% (0/3)         
        -[HGMarkdownHighlighter textViewDidScroll:]                                                                                    27.27% (3/11)       
        __43-[HGMarkdownHighlighter textViewDidScroll:]_block_invoke                                                                   0.00% (0/6)         
        __43-[HGMarkdownHighlighter textViewDidScroll:]_block_invoke_2                                                                 0.00% (0/3)         
        -[HGMarkdownHighlighter getDefaultStyles]                                                                                      100.00% (27/27)     
        -[HGMarkdownHighlighter applyStyleDependenciesToTargetTextView]                                                                92.86% (13/14)      
        -[HGMarkdownHighlighter setStyles:]                                                                                            100.00% (8/8)       
        -[HGMarkdownHighlighter getDefaultSelectedTextAttributes]                                                                      100.00% (7/7)       
        -[HGMarkdownHighlighter handleStyleParsingError:]                                                                              100.00% (12/12)     
        -[HGMarkdownHighlighter applyStylesFromStylesheet:withErrorHandler:]                                                           86.05% (74/86)      
        -[HGMarkdownHighlighter setTargetTextView:]                                                                                    100.00% (7/7)       
        -[HGMarkdownHighlighter parseAndHighlightNow]                                                                                  100.00% (3/3)       
        -[HGMarkdownHighlighter highlightNow]                                                                                          100.00% (3/3)       
        -[HGMarkdownHighlighter activate]                                                                                              100.00% (24/24)     
        -[HGMarkdownHighlighter deactivate]                                                                                            100.00% (18/18)     
    /Users/runner/work/macdown3000/macdown3000/Dependency/peg-markdown-highlight/HGMarkdownHighlightingStyle.m                         87.69% (57/65)      
        +[HGMarkdownHighlightingStyle colorFromARGBColor:]                                                                             100.00% (6/6)       
        -[HGMarkdownHighlightingStyle initWithType:attributesToAdd:toRemove:fontTraitsToAdd:]                                          88.89% (8/9)        
        -[HGMarkdownHighlightingStyle initWithStyleAttributes:baseFont:]                                                               86.00% (43/50)      

... (2401 more lines truncated)

📊 **Full coverage report available in workflow artifacts**

@schuyler schuyler merged commit eaa6da6 into main Jan 10, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants