Releases: abhinav/goldmark-mermaid
Releases · abhinav/goldmark-mermaid
v0.5.0
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
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.
Added
- 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.
v0.4.0
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
v0.2.0
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, setExtender.NoScript
orTransformer.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.