From a7390d8b338b488adf2758dbe877ceab477826aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20R=C3=BCger?= Date: Fri, 28 Nov 2025 14:07:28 +0100 Subject: [PATCH] Use strconv.Unqoute --- markdown/markdown_test.go | 32 +++++++++++++++++--------------- renderer/mkDocsAdmonition.go | 5 ++--- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/markdown/markdown_test.go b/markdown/markdown_test.go index 12ec3cb..0c02c95 100644 --- a/markdown/markdown_test.go +++ b/markdown/markdown_test.go @@ -2,6 +2,7 @@ package mark_test import ( "context" + "fmt" "os" "path" "path/filepath" @@ -51,6 +52,7 @@ func TestCompileMarkdown(t *testing.T) { } for _, filename := range testcases { + fmt.Printf("Testing: %v\n", filename) lib, err := stdlib.New(nil) if err != nil { panic(err) @@ -58,11 +60,11 @@ func TestCompileMarkdown(t *testing.T) { markdown, htmlname, html := loadData(t, filename, "") cfg := types.MarkConfig{ - MermaidScale: 1.0, - D2Scale: 1.0, - DropFirstH1: false, - StripNewlines: false, - Features: []string{"mkdocsadmonitions"}, + MermaidScale: 1.0, + D2Scale: 1.0, + DropFirstH1: false, + StripNewlines: false, + Features: []string{"mkdocsadmonitions"}, } actual, _ := mark.CompileMarkdown(markdown, lib, filename, cfg) @@ -100,11 +102,11 @@ func TestCompileMarkdownDropH1(t *testing.T) { markdown, htmlname, html := loadData(t, filename, variant) cfg := types.MarkConfig{ - MermaidScale: 1.0, - D2Scale: 1.0, - DropFirstH1: true, - StripNewlines: false, - Features: []string{"mkdocsadmonitions"}, + MermaidScale: 1.0, + D2Scale: 1.0, + DropFirstH1: true, + StripNewlines: false, + Features: []string{"mkdocsadmonitions"}, } actual, _ := mark.CompileMarkdown(markdown, lib, filename, cfg) @@ -144,11 +146,11 @@ func TestCompileMarkdownStripNewlines(t *testing.T) { markdown, htmlname, html := loadData(t, filename, variant) cfg := types.MarkConfig{ - MermaidScale: 1.0, - D2Scale: 1.0, - DropFirstH1: false, - StripNewlines: true, - Features: []string{"mkdocsadmonitions"}, + MermaidScale: 1.0, + D2Scale: 1.0, + DropFirstH1: false, + StripNewlines: true, + Features: []string{"mkdocsadmonitions"}, } actual, _ := mark.CompileMarkdown(markdown, lib, filename, cfg) diff --git a/renderer/mkDocsAdmonition.go b/renderer/mkDocsAdmonition.go index c1080ef..d22e9f2 100644 --- a/renderer/mkDocsAdmonition.go +++ b/renderer/mkDocsAdmonition.go @@ -2,7 +2,7 @@ package renderer import ( "fmt" - "strings" + "strconv" parser "github.com/stefanfritsch/goldmark-admonitions" "github.com/yuin/goldmark/ast" @@ -116,8 +116,7 @@ func (r *ConfluenceMkDocsAdmonitionRenderer) renderMkDocsAdmonition(writer util. return ast.WalkStop, err } - title := strings.Trim(string(n.Title), "\"") - + title, _ := strconv.Unquote(string(n.Title)) if title != "" { titleHTML := fmt.Sprintf("

%s

\n", title) if _, err := writer.Write([]byte(titleHTML)); err != nil {