diff --git a/.changes/unreleased/Added-20231103-215333.yaml b/.changes/unreleased/Added-20231103-215333.yaml deleted file mode 100644 index 9f2f5c2..0000000 --- a/.changes/unreleased/Added-20231103-215333.yaml +++ /dev/null @@ -1,3 +0,0 @@ -kind: Added -body: Add `CLICompiler` to render diagrams by invoking MermaidJS CLI. Plugs into ServerRenderer. -time: 2023-11-03T21:53:33.269673822-07:00 diff --git a/.changes/unreleased/Added-20231103-215358.yaml b/.changes/unreleased/Added-20231103-215358.yaml deleted file mode 100644 index 0fb4d6f..0000000 --- a/.changes/unreleased/Added-20231103-215358.yaml +++ /dev/null @@ -1,3 +0,0 @@ -kind: Added -body: 'ServerRenderer: Support pluggable `Compiler`s.' -time: 2023-11-03T21:53:58.555032881-07:00 diff --git a/.changes/unreleased/Added-20231103-215444.yaml b/.changes/unreleased/Added-20231103-215444.yaml deleted file mode 100644 index ca509ae..0000000 --- a/.changes/unreleased/Added-20231103-215444.yaml +++ /dev/null @@ -1,4 +0,0 @@ -kind: Added -body: Add mermaidcdp subpackage. This implements a Compiler for the ServerRenderer - backed by a long-running headless browser process. -time: 2023-11-03T21:54:44.954944766-07:00 diff --git a/.changes/unreleased/Changed-20231103-214954.yaml b/.changes/unreleased/Changed-20231103-214954.yaml deleted file mode 100644 index 4c38c4f..0000000 --- a/.changes/unreleased/Changed-20231103-214954.yaml +++ /dev/null @@ -1,4 +0,0 @@ -kind: Changed -body: Replace the `CLI` struct, which implemented the `MMDC` interface with a `CLI` - interface and a `func MMDC` constructor for it. -time: 2023-11-03T21:49:54.388916287-07:00 diff --git a/.changes/unreleased/Changed-20231103-215008.yaml b/.changes/unreleased/Changed-20231103-215008.yaml deleted file mode 100644 index de27a5f..0000000 --- a/.changes/unreleased/Changed-20231103-215008.yaml +++ /dev/null @@ -1,3 +0,0 @@ -kind: Changed -body: 'ClientRenderer, Extender: Rename `MermaidJS` to `MermaidURL`.' -time: 2023-11-03T21:50:08.880763382-07:00 diff --git a/.changes/unreleased/Changed-20231103-215025.yaml b/.changes/unreleased/Changed-20231103-215025.yaml deleted file mode 100644 index 7e62987..0000000 --- a/.changes/unreleased/Changed-20231103-215025.yaml +++ /dev/null @@ -1,3 +0,0 @@ -kind: Changed -body: Rename `DefaultMMDC` to `DefaultCLI`. -time: 2023-11-03T21:50:25.430408-07:00 diff --git a/.changes/unreleased/Changed-20231103-215101.yaml b/.changes/unreleased/Changed-20231103-215101.yaml deleted file mode 100644 index fa91bcd..0000000 --- a/.changes/unreleased/Changed-20231103-215101.yaml +++ /dev/null @@ -1,3 +0,0 @@ -kind: Changed -body: 'Extender: Replace `MMDC` field with the `CLI` field.' -time: 2023-11-03T21:51:01.935864784-07:00 diff --git a/.changes/unreleased/Removed-20231103-215308.yaml b/.changes/unreleased/Removed-20231103-215308.yaml deleted file mode 100644 index 5a09c81..0000000 --- a/.changes/unreleased/Removed-20231103-215308.yaml +++ /dev/null @@ -1,3 +0,0 @@ -kind: Removed -body: 'ServerRenderer: Delete `MMDC` and `Theme` fields. Use `CLICompiler` instead.' -time: 2023-11-03T21:53:08.048952903-07:00 diff --git a/.changes/v0.5.0.md b/.changes/v0.5.0.md new file mode 100644 index 0000000..6d053a7 --- /dev/null +++ b/.changes/v0.5.0.md @@ -0,0 +1,48 @@ +## 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 +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. diff --git a/CHANGELOG.md b/CHANGELOG.md index 944c3c9..881a38f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,55 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), and is generated by [Changie](https://github.com/miniscruff/changie). +## 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 +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. + ## v0.4.0 - 2023-03-24 ### Changed - ClientRenderer: Use `
` instead of `
` for diagram containers.