From 5e2b7b64e87800bff59c225acc785a8e7d350eb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20R=C3=BCger?= Date: Wed, 13 Aug 2025 10:30:11 +0200 Subject: [PATCH] Drop cloudscript support for mermaid --- README.md | 6 ------ markdown/markdown_test.go | 3 --- renderer/fencedcodeblock.go | 3 ++- stdlib/stdlib.go | 5 ++--- testdata/codes-stripnewlines.html | 6 +++--- testdata/codes.html | 6 +++--- testdata/codes.md | 1 + types/types.go | 1 - util/cli.go | 2 -- util/flags.go | 6 ------ 10 files changed, 11 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 16c49f4..19efdbd 100644 --- a/README.md +++ b/README.md @@ -724,11 +724,6 @@ graph TD; A-->B; ``` -In order to properly render mermaid, you can choose between the following mermaid providers: - -* "mermaid-go" via [mermaid.go](https://github.com/dreampuf/mermaid.go) -* "cloudscript" via [cloudscript-io-mermaid-addon](https://marketplace.atlassian.com/apps/1219878/cloudscript-io-mermaid-addon) (deprecated) - ### Render D2 Diagram Optionally you can enable [D2](https://github.com/terrastruct/d2) rendering via `--features="d2"`. @@ -829,7 +824,6 @@ GLOBAL OPTIONS: --space string use specified space key. If the space key is not specified, it must be set in the page metadata. [$MARK_SPACE] --parents string A list containing the parents of the document separated by parents-delimiter (default: '/'). These will be prepended to the ones defined in the document itself. [$MARK_PARENTS] --parents-delimiter string The delimiter used for the parents list (default: "/") [$MARK_PARENTS_DELIMITER] - --mermaid-provider string defines the mermaid provider to use. Supported options are: cloudscript, mermaid-go. (default: "cloudscript") [$MARK_MERMAID_PROVIDER] --mermaid-scale float defines the scaling factor for mermaid renderings. (default: 1) [$MARK_MERMAID_SCALE] --include-path string Path for shared includes, used as a fallback if the include doesn't exist in the current directory. [$MARK_INCLUDE_PATH] --changes-only Avoids re-uploading pages that haven't changed since the last run. (default: false) [$MARK_CHANGES_ONLY] diff --git a/markdown/markdown_test.go b/markdown/markdown_test.go index 12ea8f8..12ec3cb 100644 --- a/markdown/markdown_test.go +++ b/markdown/markdown_test.go @@ -58,7 +58,6 @@ func TestCompileMarkdown(t *testing.T) { markdown, htmlname, html := loadData(t, filename, "") cfg := types.MarkConfig{ - MermaidProvider: "", MermaidScale: 1.0, D2Scale: 1.0, DropFirstH1: false, @@ -101,7 +100,6 @@ func TestCompileMarkdownDropH1(t *testing.T) { markdown, htmlname, html := loadData(t, filename, variant) cfg := types.MarkConfig{ - MermaidProvider: "", MermaidScale: 1.0, D2Scale: 1.0, DropFirstH1: true, @@ -146,7 +144,6 @@ func TestCompileMarkdownStripNewlines(t *testing.T) { markdown, htmlname, html := loadData(t, filename, variant) cfg := types.MarkConfig{ - MermaidProvider: "", MermaidScale: 1.0, D2Scale: 1.0, DropFirstH1: false, diff --git a/renderer/fencedcodeblock.go b/renderer/fencedcodeblock.go index ab2bf04..bc89650 100644 --- a/renderer/fencedcodeblock.go +++ b/renderer/fencedcodeblock.go @@ -108,6 +108,7 @@ func (r *ConfluenceFencedCodeBlockRenderer) renderFencedCodeBlock(writer util.Bu collapse = false continue } + var i int if _, err := fmt.Sscanf(option, "%d", &i); err == nil { linenumbers = i > 0 @@ -158,7 +159,7 @@ func (r *ConfluenceFencedCodeBlockRenderer) renderFencedCodeBlock(writer util.Bu return ast.WalkStop, err } - } else if lang == "mermaid" && slices.Contains(r.MarkConfig.Features, "mermaid") && r.MarkConfig.MermaidProvider == "mermaid-go" { + } else if lang == "mermaid" && slices.Contains(r.MarkConfig.Features, "mermaid") { attachment, err := mermaid.ProcessMermaidLocally(title, lval, r.MarkConfig.MermaidScale) if err != nil { log.Debugf(nil, "error: %v", err) diff --git a/stdlib/stdlib.go b/stdlib/stdlib.go index d77727a..8b6e18b 100644 --- a/stdlib/stdlib.go +++ b/stdlib/stdlib.go @@ -114,9 +114,8 @@ func templates(api *confluence.API) (*template.Template, error) { // This template is used for rendering code in ``` `ac:code`: text( - ``, - /**/ `{{ if eq .Language "mermaid" }}true{{ else }}`, - /**/ `{{ .Language }}{{ end }}`, + ``, + /**/ `{{ .Language }}`, /**/ `{{ .Collapse }}`, /**/ `{{ if .Theme }}{{ .Theme }}{{ end }}`, /**/ `{{ if .Linenumbers }}{{ .Linenumbers }}{{ end }}`, diff --git a/testdata/codes-stripnewlines.html b/testdata/codes-stripnewlines.html index 84a08fa..b641ce3 100644 --- a/testdata/codes-stripnewlines.html +++ b/testdata/codes-stripnewlines.html @@ -4,15 +4,15 @@ unknownfalseshfalseA b cbashtrueA b cctruenestedfalsefalsetruefalsemermaidfalseB; A-->C; B-->D; - C-->D;]]>truetruemy mermaid graphD;]]>mermaidtruemy mermaid graphB; A-->C; B-->D; - C-->D;]]>truefalsemy mermaid graphD;]]>mermaidfalsemy mermaid graphB; A-->C; B-->D; diff --git a/testdata/codes.html b/testdata/codes.html index c4608ce..2d6d812 100644 --- a/testdata/codes.html +++ b/testdata/codes.html @@ -5,15 +5,15 @@ text 2

unknownfalseshfalseA b cbashtrueA b cctruenestedfalsefalsetruefalsemermaidfalseB; A-->C; B-->D; - C-->D;]]>truetruemy mermaid graphD;]]>mermaidtruemy mermaid graphB; A-->C; B-->D; - C-->D;]]>truefalsemy mermaid graphD;]]>mermaidfalsemy mermaid graphB; A-->C; B-->D; diff --git a/testdata/codes.md b/testdata/codes.md index 082f710..237db81 100644 --- a/testdata/codes.md +++ b/testdata/codes.md @@ -42,6 +42,7 @@ even more code indented code block with multiple lines + ```mermaid graph TD; A-->B; diff --git a/types/types.go b/types/types.go index 49f5941..177aaaf 100644 --- a/types/types.go +++ b/types/types.go @@ -1,7 +1,6 @@ package types type MarkConfig struct { - MermaidProvider string MermaidScale float64 D2Scale float64 DropFirstH1 bool diff --git a/util/cli.go b/util/cli.go index e61535b..393b08c 100644 --- a/util/cli.go +++ b/util/cli.go @@ -220,7 +220,6 @@ func processFile( } cfg := types.MarkConfig{ - MermaidProvider: cmd.String("mermaid-provider"), MermaidScale: cmd.Float("mermaid-scale"), D2Scale: cmd.Float("d2-scale"), DropFirstH1: cmd.Bool("drop-h1"), @@ -300,7 +299,6 @@ func processFile( ) } cfg := types.MarkConfig{ - MermaidProvider: cmd.String("mermaid-provider"), MermaidScale: cmd.Float("mermaid-scale"), D2Scale: cmd.Float("d2-scale"), DropFirstH1: cmd.Bool("drop-h1"), diff --git a/util/flags.go b/util/flags.go index efd7d3c..87ef441 100644 --- a/util/flags.go +++ b/util/flags.go @@ -155,12 +155,6 @@ var Flags = []cli.Flag{ Usage: "The delimiter used for the parents list", Sources: cli.NewValueSourceChain(cli.EnvVar("MARK_PARENTS_DELIMITER"), altsrctoml.TOML("parents-delimiter", altsrc.NewStringPtrSourcer(&filename))), }, - &cli.StringFlag{ - Name: "mermaid-provider", - Value: "cloudscript", - Usage: "defines the mermaid provider to use. Supported options are: cloudscript, mermaid-go.", - Sources: cli.NewValueSourceChain(cli.EnvVar("MARK_MERMAID_PROVIDER"), altsrctoml.TOML("mermaid-provider", altsrc.NewStringPtrSourcer(&filename))), - }, &cli.FloatFlag{ Name: "mermaid-scale", Value: 1.0,