Skip to content

feat: add handDrawn look option for sketch-style rendering#46

Merged
hustcc merged 4 commits into
hustcc:mainfrom
smorand:feat/handDrawn-look
May 15, 2026
Merged

feat: add handDrawn look option for sketch-style rendering#46
hustcc merged 4 commits into
hustcc:mainfrom
smorand:feat/handDrawn-look

Conversation

@smorand

@smorand smorand commented May 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds an optional look parameter (classic | handDrawn, default classic) to the generate_mermaid_diagram tool
  • Mermaid v11 ships with a built-in sketch/Excalidraw-style renderer via rough.js, this just exposes it through the MCP schema so users can request it directly
  • Propagated into both local rendering (mermaidConfig.look) and the mermaid.ink payload for svg_url / png_url outputs
  • Fully backwards compatible: omitting look keeps the current behavior

Test plan

  • Updated tool schema snapshot fixture (__tests__/tools/mermaid.json)
  • Added unit tests for createMermaidInkUrl covering default, handDrawn, and variant path
  • All 11 vitest tests pass locally
  • Manually verified handDrawn PNG rendering against a flowchart

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 look to the tool input schema (defaulting to classic) and snapshot it in the schema fixture.
  • Propagate look into local mermaidConfig and into the mermaid.ink payload used for svg_url / png_url.
  • Add unit tests to validate createMermaidInkUrl payload behavior for default and handDrawn.

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.

Comment thread src/utils/render.ts Outdated
Comment thread src/server.ts Outdated
Comment thread src/utils/mermaidUrl.ts
@hustcc hustcc merged commit 1349706 into hustcc:main May 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants