Repository navigation
fix(frontend): render mermaid diagrams in wiki pages - #5082
Open
pcbeingused333 wants to merge 2 commits into
Open
pcbeingused333 wants to merge 2 commits into
pcbeingused333 wants to merge 2 commits into
Conversation
Wiki pages are rendered with marked and v-html, so a ```mermaid fence showed up as plain code. Emit mermaid fences as pending mermaid blocks and run the existing renderMermaidInContainer over the reader, index and graph drawer bodies after each render. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The reader body is behind v-if="!editingPage", so saving or cancelling an edit mounts a fresh element whose protected images and mermaid diagrams are pending again, but no watcher fired (cancel leaves renderedContent unchanged). Extract refreshReaderBody() and run it when editing ends. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
Author
|
Thanks for the report. Cause: the wiki reader body is rendered under This comment was drafted with Claude Code. |
6 of 17 tasks
This branch has not been deployed
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.


Description
Wiki pages are rendered with
markedand injected withv-html, so a```mermaidfence stayed as plain code in the wiki browser even though the same diagram renders in chat.wiki/wikiMermaid.ts: a marked renderer that emits```mermaidfences as a pending<pre class="mermaid" data-mermaid="false">block and leaves every other code fence on marked's default rendering.renderWikiMermaid()runs the existingrenderMermaidInContainerover a container, lazily, and only if it holds a pending diagram.WikiBrowser.vue:renderMarkdown()uses that renderer, and the reader, index and graph-drawer bodies callrenderWikiMermaid()after each render (next to the existinghydrateProtectedFileImagescalls). A small style keeps the SVG centred and within the page width.The chat block chrome (header, expand button) is not reused: its styles live inside the chat-only typography mixin, so this keeps the wiki change small.
Type of Change
Related Issue
Fixes #5076
Testing
npx tsx --test src/views/knowledge/wiki/wikiMermaid.test.ts(2 passing): a mermaid fence becomes a pending block with its source escaped, and other fences render exactly as before. The rendered wiki page was not checked in a browser.Checklist
git diff --check origin/main...HEADpassesgolangci-lint run --new-from-rev=origin/main ./...)website-docs/, Swagger annotations, etc.)This change was prepared with the help of an AI assistant (Claude Code), and the author is responsible for the change.
🤖 Generated with Claude Code