All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, adheres to Semantic Versioning, and is generated by Changie.
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.
- ServerRenderer: Delete
MMDC
andTheme
fields. If you need these, you can provide them with theCLICompiler
instead. CLI
andMMDC
were flipped. The oldMMDC
interface is now namedCLI
, and it now accepts a context. You can use the newMMDC
function to build an instance of it.- ClientRenderer, Extender: Rename
MermaidJS
toMermaidURL
. - Rename
DefaultMMDC
toDefaultCLI
. - Extender: Replace
MMDC
field with theCLI
field.
- ServerRenderer now supports pluggable
Compiler
s. - 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.
- ClientRenderer: Use
<pre>
instead of<div>
for diagram containers.
- Support changing the container tag with the
ContainerTag
option. This option is available on ClientRenderer, ServerRenderer, and Extender.
- Change the module path to
go.abhg.dev/goldmark/mermaid
.
- Delete previously deprecated Renderer type. Please use the ClientRenderer instead.
- 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, setExtender.NoScript
orTransformer.NoScript
to true. Use this if the page you're rendering into already includes the tag elsewhere.
- Deprecate Renderer in favor of ClientRenderer. Rendere has been aliased to the new type so existing code should continue to work unchanged.
- Fix handling of multiple mermaid blocks.
- Initial release.