Address issue #18: Fix Mermaid gantt diagram rendering issues#151
Merged
Address issue #18: Fix Mermaid gantt diagram rendering issues#151
Conversation
- Remove mermaid.forest.css loading from MPRenderer.m - Use Mermaid 8.0+ theme API with 'forest' theme in mermaid.init.js - Fixes today's indicator disappearing when dateFormat not set - Fixes x-axis date label overlap in gantt charts This applies the fix from MacDownApp/macdown#1156 which addresses the issue where external CSS interferes with Mermaid's internal theming system. By using the modern theme API, Mermaid's built-in rendering works correctly while maintaining the forest theme appearance. Changes: - Removed mermaidStylesheets property and method - Removed CSS loading from preview rendering path - Removed CSS loading from HTML export path - Added theme: 'forest' to mermaid.initialize() Related to #18
Comprehensive testing plan for verifying Mermaid gantt diagram rendering fix. Includes test scenarios, expected results, and visual inspection guidelines. Related to #18
Contributor
Code Coverage ReportCurrent Coverage: 40.43% Coverage Details (Summary) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes Mermaid gantt diagram rendering issues by removing external CSS and using Mermaid's modern theme API.
Changes Made
mermaid.forest.cssloading fromMPRenderer.mtheme: 'forest'tomermaid.initialize()inmermaid.init.jsmermaidStylesheetsproperty and methodIssues Fixed
✅ Today's indicator line now appears correctly in gantt charts (with and without explicit
dateFormat)✅ X-axis date labels no longer overlap
✅ Forest theme appearance preserved
✅ All other Mermaid diagram types continue to work correctly
Technical Details
The root cause was that external CSS (
mermaid.forest.css) interfered with Mermaid 8.0+'s internal theme system. Modern Mermaid versions expect theme configuration via the JavaScript API, not external stylesheets. This fix:theme: 'forest')This approach follows the fix from MacDownApp/macdown#1156.
Code Changes
Files Modified:
MacDown/Resources/Extensions/mermaid.init.js(+3 lines)MacDown/Code/Document/MPRenderer.m(-18 lines)Net Change: -15 lines
Testing
✅ Automated Tests: All unit tests pass on macOS runner (CI)
📋 Manual Testing Plan: Available at
plans/MANUAL_TEST_PLAN_ISSUE_18.mdCode Review
✅ Architectural review: Approved by Groucho (architectural guidance)
✅ Code review: Approved by Chico - MERGE READY
✅ Documentation review: Completed by Harpo - No updates needed
✅ Testing plan: Provided by Zeppo - Comprehensive manual test plan available
Manual Testing
A comprehensive manual testing plan is available for visual verification:
dateFormatRelated Issue
Related to #18
Note: Per project convention, this PR uses "Related to" rather than "Fixes" or "Closes" to avoid auto-closing the issue. Manual verification is recommended before closing the issue.