Fix unknown diagram error in Mermaid rendering#36
Merged
Conversation
Owner
|
@copilot 继续 |
Contributor
Author
Fixed in a1e9325. Root cause: Changes:
|
Copilot
AI
changed the title
[WIP] Fix unknown diagram error in Mermaid rendering
Fix unknown diagram error in Mermaid rendering
Mar 27, 2026
hustcc
approved these changes
Mar 27, 2026
Owner
|
@copilot 给我一个测试链接,我验收看看。 |
Contributor
Author
使用 issue 中相同的 flowchart 示例生成的测试链接: 这两个链接使用的是修复后的 JSON 格式 |
hustcc
approved these changes
Mar 27, 2026
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.
Fixes the "Unknown diagram error" that occurs when using
png_urlorsvg_urloutput types with mermaid.ink.Root Cause
createMermaidInkUrlwas compressing the raw mermaid syntax string directly, but mermaid.ink'spako:endpoint expects the payload to be a JSON object in the format{"code": "<mermaid>", "mermaid": {"theme": "..."}}— the same format used by the Mermaid Live Editor.Changes Made
src/utils/mermaidUrl.ts: UpdatedcreateMermaidInkUrlto wrap the mermaid code in the required JSON payload{code, mermaid: {theme}}before deflating and base64url-encoding it. Added athemeparameter to the function signature.src/server.ts: Pass the user-selectedtheme(with"default"fallback) through tocreateMermaidInkUrl.Original prompt
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.