-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
101 additions
and
26 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
## 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: | ||
|
||
```go | ||
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 `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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters