Programming

How to Render Hand-Drawn Mermaid Diagrams with the Mermaid 13 Hand-Drawn Plugin

A verification-first workflow for trying Mermaid 13’s hand-drawn look without guessing the plugin’s installation or rendering API.

Mermaid 13’s hand-drawn plugin promises a sketch-style look for diagrams, but getting that result into an application depends on more than adding a configuration flag. You also need a Mermaid 13 setup that loads the plugin and a rendering path compatible with the diagram you want to show.

The available first-party material identifies @mermaid-js/plugin-hand-drawn and describes the hand-drawn option as handDrawn: true (or, in Mermaid 12, look: handDrawn). That is enough to identify the feature and its configuration vocabulary. It is not enough to verify an install command, a JavaScript import, a renderer call, or a complete working example. The release URL identifies version 13.0.0-beta.5, but the supplied release excerpt contains no package instructions.

This tutorial shows how to approach the specific task—rendering a diagram with the Mermaid 13 hand-drawn plugin—without filling those gaps with plausible but unverified code. You will prepare a small test diagram, inspect the exact package release and its official documentation, wire it into your renderer only when its documented API is available, and verify the output and fallback behavior. If the package documentation does not provide the missing steps, the right next step is to stop and obtain them, not to guess.

What the feature information establishes

The Mermaid v13 alpha page names @mermaid-js/plugin-hand-drawn and describes the hand-drawn look using handDrawn: true. It also mentions look: handDrawn as the Mermaid 12 spelling. That is a useful distinction when diagnosing configuration examples: a snippet written for one major version should not automatically be copied into another.

The release URL supplied for this task points to a release tagged @mermaid-js/[email protected]. The beta label is important when planning a test: treat this as a prerelease evaluation, not proof of a stable production-ready integration. The URL alone does not establish which runtime, bundler, or diagram types are supported.

The independent Mermaid syntax-reference page is a place to check diagram source syntax. It describes diagram declarations, configuration, and syntax pitfalls. It does not, in the supplied excerpt, document this plugin’s package API. Keep those two questions separate: valid Mermaid text is not by itself evidence that the plugin has been loaded.

1. Make a small, identifiable test diagram

Begin with a diagram simple enough that you can tell whether it rendered and whether its output changed. For example, use a short flowchart with a start, one action, and an end. Keep the source in a file or editor you can revisit, and record the Mermaid version and rendering environment you intend to test.

flowchart TD
    A["Start"] --> B["Review input"]
    B --> C["Finish"]

This diagram is a test input, not an example of the plugin API. Its purpose is to give you a stable comparison. If you already have a diagram that fails, preserve a copy of that source too; simplifying it should not erase the original failure case.

Before enabling the plugin, establish a baseline with your existing renderer. Record whether the diagram renders, what output format or preview your tool produces, and any warnings it reports. This helps distinguish a syntax problem from a plugin-loading problem. Do not infer plugin support simply because the ordinary diagram renders successfully.

A useful test record is deliberately small:

Item Record
Diagram source The exact text tested
Mermaid version The version resolved by the project
Plugin version The exact version, if installed
Rendering environment Browser, build step, or other host
Baseline Whether the diagram rendered before the change
Result Output, visible errors, and warnings

If you cannot identify the Mermaid version your host uses, resolve that before changing configuration. A global editor, a documentation site, and an application bundle may use different Mermaid installations.

2. Inspect the exact plugin release

The supplied release is @mermaid-js/[email protected]. Before changing your project, open that exact first-party release page and look for installation instructions, supported Mermaid versions, exports, configuration examples, and known limitations. The release page URL is useful for locating the release, but the supplied excerpt does not show any of those details. Do not treat the tag or page title as a substitute for reading its package instructions.

If you use npm, query the registry for package metadata rather than guessing a package layout:

npm view @mermaid-js/[email protected] \
  name version description dependencies peerDependencies exports types readme

This is a metadata lookup, not an installation command. Check whether the published metadata identifies peer dependencies and entry points, and whether a package README contains setup instructions. These fields are places to investigate; their actual values are not established by the supplied excerpts.

If the exact package version cannot be found, or its documentation does not state how to load it, stop here. Do not invent an import such as import ... from ..., assume a default export, or copy an API from another Mermaid integration. A package name and a configuration option do not tell you how the package is initialized.

3. Match the configuration to Mermaid 13

The first-party v13 alpha material gives the relevant option spelling as handDrawn: true. It contrasts that with Mermaid 12’s look: handDrawn. Use the v13 form only after the package’s own instructions tell you where and how to provide that setting.

This is the point at which an implementation guide normally supplies a renderer call and an import. The available release excerpt does not provide either. Consequently, there is no source-supported, runnable JavaScript setup to give here. In particular, do not turn the option name into an assumed top-level configuration object, a diagram frontmatter block, or a function argument: the excerpt does not establish which location the plugin expects.

Once the release documentation supplies the loading and configuration steps, apply them to a separate test branch or minimal reproduction. Change one thing at a time:

  1. Add the dependency using the documented package-manager command.
  2. Add the documented plugin loading step.
  3. Set the hand-drawn option in the documented location.
  4. Render the unchanged test diagram.
  5. Record errors and compare the output with your baseline.

The list is a test sequence, not a substitute for the missing API instructions. Do not execute steps 1–3 using guessed commands or code. If the official release docs do not contain them, ask the package maintainers or wait for clearer package documentation.

4. Verify the result at the rendering boundary

A successful dependency installation alone does not show that the diagram is using the plugin. Verify the result where your application actually renders Mermaid: for example, in the page or build output your users will see, rather than only in a separate editor that may bundle its own Mermaid version.

Use the same diagram source before and after the change. Check three separate outcomes:

  • The diagram still renders. If the baseline worked but the modified setup fails, capture the full error and determine whether the failure occurs during package loading, configuration, or diagram parsing.
  • The requested look is applied. Compare the rendered result with the baseline. The option name alone is not visual proof that the plugin was loaded or selected.
  • The rest of the host still works. If your rendering environment has multiple diagrams, test at least one ordinary diagram alongside the small test case. The supplied excerpts do not promise behavior for every diagram type.

Keep screenshots or other before-and-after output when visual comparison matters. If output is generated during a build, record the command your project uses and inspect the generated result. Do not report a successful build as proof of the hand-drawn effect if you have not checked the rendered diagram.

The Mermaid syntax reference is useful when the source itself may be invalid: it covers diagram declarations and syntax pitfalls. Use it to investigate source errors, while consulting the exact plugin release for package and configuration behavior. This separation avoids a common debugging dead end: repeatedly editing diagram syntax when the renderer never loaded the plugin in the first place.

5. Test failure and fallback behavior

A practical integration also needs a clear failure path. First test with the plugin enabled. Then, in your test branch, disable or remove the plugin using the release’s documented mechanism and verify that you can return to the baseline. The supplied excerpts do not specify a fallback API, so do not assume that a particular flag, import removal, or runtime toggle is supported.

If the hand-drawn version fails while the baseline works, preserve the exact package version, diagram source, host version, and error output. Reduce the reproduction to the smallest diagram that still fails. Then check the release notes and official package documentation for a matching limitation before changing unrelated application code.

For a beta dependency, keep the experiment isolated until you have tested the build and runtime environments you actually support. A local preview succeeding does not establish that a server-side build or a different browser bundle uses the same Mermaid package. The available source material does not specify those compatibility guarantees; verify them in your own supported environments and in the release documentation.

Troubleshooting checklist

The package installs, but the output looks unchanged. Confirm that the app’s renderer uses the Mermaid version and plugin instance you modified. Then check the documented option location and plugin activation instructions. The option spelling alone does not establish that the plugin is active.

The project cannot resolve the package. Check the exact package name and version against the release page and registry metadata. Do not silently substitute a different package or version; that would test a different integration.

A Mermaid 12 example fails under Mermaid 13. Re-check the version-specific spelling. The supplied first-party v13 material says handDrawn: true and identifies look: handDrawn as the Mermaid 12 form. It does not document every migration detail, so consult the release instructions for the correct configuration context.

The diagram fails before the visual change can be assessed. Test the source with your established baseline renderer and consult the Mermaid syntax reference for syntax issues. If the baseline succeeds, focus on the plugin loading and configuration steps rather than rewriting the diagram immediately.

You cannot find a complete setup example. Do not ship guessed integration code. The release excerpt available here does not include an install command, export name, or renderer invocation. Obtain those details from the exact package documentation or maintainers before proceeding.

The practical rule

Treat Mermaid 13’s hand-drawn option as a feature to verify, not as a complete integration recipe. The first-party v13 page supplies the option name; the release URL identifies a beta package; and the independent syntax reference helps with diagram text. None of the supplied excerpts establishes the package’s runnable installation and rendering API.

So prepare a minimal diagram, inspect the exact release, follow its documented package setup, and verify the visual result in the renderer your application uses. If those instructions are absent, the safest and most useful outcome is a reproducible test case and an explicit request for the missing API details—not a code sample that only looks plausible.

External Sources used for this article

Related Articles

View all →