Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds Mermaid diagram rendering support to the markdown preview functionality. The implementation includes a custom React hook for injecting rendered Mermaid diagrams into the preview, along with necessary CSS styling and component integration.
- Adds mermaid library (v11.12.0) for diagram rendering
- Implements custom hook
useMermaidInjectorwith diagram caching and reactive updates - Integrates Mermaid code block rendering into the markdown preview component
Reviewed Changes
Copilot reviewed 7 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| ui/leafwiki-ui/src/lib/utils.ts | Adds unused hashString utility function |
| ui/leafwiki-ui/src/index.css | Adds CSS rules for Mermaid diagram containers |
| ui/leafwiki-ui/src/features/preview/useMermaidInjector.ts | Implements custom hook for Mermaid diagram rendering and injection |
| ui/leafwiki-ui/src/features/preview/remarkLineNumber.ts | Adds remark plugin to attach line numbers to markdown nodes |
| ui/leafwiki-ui/src/features/preview/MermaidBlock.tsx | Creates component wrapper for Mermaid diagrams |
| ui/leafwiki-ui/src/features/preview/MarkdownPreview.tsx | Updates preview to support Mermaid blocks and adds renderer sandbox element |
| ui/leafwiki-ui/src/features/page/PageViewer.tsx | Adds CSS class to page container |
| ui/leafwiki-ui/package.json | Adds mermaid dependency |
| ui/leafwiki-ui/package-lock.json | Updates lock file with mermaid and dependencies |
Files not reviewed (1)
- ui/leafwiki-ui/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…compatibility (#251) * fix: move mermaid initialization to useEffect to avoid React Strict Mode issues
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.
No description provided.