feat: integrate mermaid.js for diagram rendering #319
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 introduces support for rendering Mermaid.js diagrams, allowing users to create and view flowcharts, sequence diagrams, and more directly within their notes. This enhancement significantly expands the capabilities of Flatnotes as a technical documentation and note-taking tool.
Features
mermaid
are now automatically rendered as interactive SVG diagrams.InteractiveMermaid.vue
): A new, self-contained Vue component that provides:Implementation Details
mermaid
library topackage.json
.mermaidRenderer.js
): A new utility module is responsible for finding Mermaid code blocks and mounting theInteractiveMermaid.vue
component. This approach ensures proper Vue lifecycle management and cleanup.ToastEditor.vue
andToastViewer.vue
are updated to utilize the new renderer, enabling diagram support in both the live preview and the final note view.toastui-editor-overrides.scss
to support the interactive controls, fullscreen mode, and theming of the Mermaid viewer.This feature is designed to be modular and minimally invasive to the core application logic. Looking forward to your feedback!
This feature was developed with the assistance of Gemini 2.5 Pro. Please let me know if any changes are needed. Thank you!
Dark Theme:

Error:
