feat: add handDrawn look option for sketch-style rendering#46
Merged
Conversation
Mermaid v11 supports a 'look' setting that switches diagrams to a sketchy, Excalidraw-style rendering via rough.js. This exposes it as an optional parameter on the MCP tool so users can request that style from their AI assistant without having to embed a frontmatter config block. - Add 'look' field to the Zod schema (enum: classic, handDrawn; default classic) - Pass it through renderMermaid into mermaidConfig - Propagate it to the mermaid.ink payload for svg_url / png_url outputs - Update tool snapshot fixture and add unit tests for createMermaidInkUrl Backwards compatible: default 'classic' preserves current behavior.
hustcc
approved these changes
May 14, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR exposes Mermaid v11’s sketch-style renderer by adding a new optional look parameter (classic | handDrawn) to the generate_mermaid_diagram tool and threading it through both local rendering and mermaid.ink URL generation.
Changes:
- Add
lookto the tool input schema (defaulting toclassic) and snapshot it in the schema fixture. - Propagate
lookinto localmermaidConfigand into themermaid.inkpayload used forsvg_url/png_url. - Add unit tests to validate
createMermaidInkUrlpayload behavior for default andhandDrawn.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/utils/render.ts |
Accepts look and forwards it into mermaidConfig for local rendering. |
src/utils/mermaidUrl.ts |
Adds look to the JSON payload encoded into mermaid.ink URLs. |
src/tools/index.ts |
Extends the Zod tool schema with the look enum + default. |
src/server.ts |
Plumbs look from tool args into both local rendering and URL generation; logs include look. |
__tests__/utils/mermaidUrl.spec.ts |
Adds tests to ensure look is encoded into the compressed mermaid.ink payload. |
__tests__/tools/mermaid.json |
Updates the tool schema snapshot to include look. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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
lookparameter (classic|handDrawn, defaultclassic) to thegenerate_mermaid_diagramtoolmermaidConfig.look) and themermaid.inkpayload forsvg_url/png_urloutputslookkeeps the current behaviorTest plan
__tests__/tools/mermaid.json)createMermaidInkUrlcovering default, handDrawn, and variant path