Skip to content

Releases: abhinav/goldmark-mermaid

v0.5.0

04 Nov 06:00
061ebbe
Compare
Choose a tag to compare

v0.5.0 - 2023-11-03

This release brings support for rendering diagrams server-side
without the need for the MermaidJS CLI.

You can use this functionality by installing a mermaidcdp.Compiler
into your mermaid.Extender or mermaid.ServerRenderer.
For example:

import "go.abhg.dev/goldmark/mermaid/mermaidcdp"

compiler, err := mermaidcdp.New(&mermaidcdp.Config{
  JSSource: mermaidJSSource, // contents of mermaid.min.js
})
if err != nil {
  return err
}
defer compiler.Close()

md := goldmark.New(
  goldmark.WithExtensions(
    // ...
    &mermaid.Extender{
      Compiler: compiler,
    },
  ),
  // ...
)

Use of mermaidcdp is highly recommended for server-side rendering
if you have lots of diagrams or documents to render.
This should be substantially faster than invoking the mmdc CLI.

Breaking changes

  • ServerRenderer: Delete MMDC and Theme fields.
    If you need these, you can provide them with the CLICompiler instead.
  • CLI and MMDC were flipped.
    The old MMDC interface is now named CLI, and it now accepts a context.
    You can use the new MMDC function to build an instance of it.
  • ClientRenderer, Extender: Rename MermaidJS to MermaidURL.
  • Rename DefaultMMDC to DefaultCLI.
  • Extender: Replace MMDC field with the CLI field.

Added

  • ServerRenderer now supports pluggable Compilers.
  • Add CLICompiler to render diagrams by invoking MermaidJS CLI. Plugs into ServerRenderer.
  • Add mermaidcdp subpackage to render diagrams with a long-running Chromium-based process.
    Plugs into ServerRenderer.

v0.4.0

24 Mar 12:53
accc4b6
Compare
Choose a tag to compare

What's New

Changed

  • ClientRenderer: Use <pre> instead of <div> for diagram containers.

Added

  • Support changing the container tag with the ContainerTag option.
    This option is available on ClientRenderer, ServerRenderer, and Extender.

New Contributors

Full Changelog: v0.3.0...v0.4.0

v0.3.0

20 Dec 02:43
643c6fa
Compare
Choose a tag to compare

Changed

  • Change the module path to go.abhg.dev/goldmark/mermaid.

Removed

  • Delete previously deprecated Renderer type.
    Please use the ClientRenderer instead.

v0.2.0

04 Nov 23:51
6da77ab
Compare
Choose a tag to compare

Added

  • ServerRenderer with support for rendering Mermaid diagrams
    into inline SVGs server-side.
    This is picked automatically if an 'mmdc' executable is found on PATH.
  • Support opting out of the MermaidJS <script> tag.
    To use, set Extender.NoScript or Transformer.NoScript to true.
    Use this if the page you're rendering into already includes the tag
    elsewhere.

Changed

  • Deprecate Renderer in favor of ClientRenderer.
    Renderer has been aliased to the new type
    so existing code should continue to work unchanged.

v0.1.1

03 Nov 12:37
9998b96
Compare
Choose a tag to compare

Fixed

  • (#3): Fix handling of multiple mermaid blocks.

v0.1.0

12 Apr 20:14
aa6f934
Compare
Choose a tag to compare
  • Initial release.