mirror of
https://github.com/kovetskiy/mark.git
synced 2025-12-15 05:37:36 +08:00
Use strconv.Unqoute
This commit is contained in:
parent
5a70073a01
commit
a7390d8b33
@ -2,6 +2,7 @@ package mark_test
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -51,6 +52,7 @@ func TestCompileMarkdown(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, filename := range testcases {
|
for _, filename := range testcases {
|
||||||
|
fmt.Printf("Testing: %v\n", filename)
|
||||||
lib, err := stdlib.New(nil)
|
lib, err := stdlib.New(nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
@ -58,11 +60,11 @@ func TestCompileMarkdown(t *testing.T) {
|
|||||||
markdown, htmlname, html := loadData(t, filename, "")
|
markdown, htmlname, html := loadData(t, filename, "")
|
||||||
|
|
||||||
cfg := types.MarkConfig{
|
cfg := types.MarkConfig{
|
||||||
MermaidScale: 1.0,
|
MermaidScale: 1.0,
|
||||||
D2Scale: 1.0,
|
D2Scale: 1.0,
|
||||||
DropFirstH1: false,
|
DropFirstH1: false,
|
||||||
StripNewlines: false,
|
StripNewlines: false,
|
||||||
Features: []string{"mkdocsadmonitions"},
|
Features: []string{"mkdocsadmonitions"},
|
||||||
}
|
}
|
||||||
|
|
||||||
actual, _ := mark.CompileMarkdown(markdown, lib, filename, cfg)
|
actual, _ := mark.CompileMarkdown(markdown, lib, filename, cfg)
|
||||||
@ -100,11 +102,11 @@ func TestCompileMarkdownDropH1(t *testing.T) {
|
|||||||
markdown, htmlname, html := loadData(t, filename, variant)
|
markdown, htmlname, html := loadData(t, filename, variant)
|
||||||
|
|
||||||
cfg := types.MarkConfig{
|
cfg := types.MarkConfig{
|
||||||
MermaidScale: 1.0,
|
MermaidScale: 1.0,
|
||||||
D2Scale: 1.0,
|
D2Scale: 1.0,
|
||||||
DropFirstH1: true,
|
DropFirstH1: true,
|
||||||
StripNewlines: false,
|
StripNewlines: false,
|
||||||
Features: []string{"mkdocsadmonitions"},
|
Features: []string{"mkdocsadmonitions"},
|
||||||
}
|
}
|
||||||
|
|
||||||
actual, _ := mark.CompileMarkdown(markdown, lib, filename, cfg)
|
actual, _ := mark.CompileMarkdown(markdown, lib, filename, cfg)
|
||||||
@ -144,11 +146,11 @@ func TestCompileMarkdownStripNewlines(t *testing.T) {
|
|||||||
markdown, htmlname, html := loadData(t, filename, variant)
|
markdown, htmlname, html := loadData(t, filename, variant)
|
||||||
|
|
||||||
cfg := types.MarkConfig{
|
cfg := types.MarkConfig{
|
||||||
MermaidScale: 1.0,
|
MermaidScale: 1.0,
|
||||||
D2Scale: 1.0,
|
D2Scale: 1.0,
|
||||||
DropFirstH1: false,
|
DropFirstH1: false,
|
||||||
StripNewlines: true,
|
StripNewlines: true,
|
||||||
Features: []string{"mkdocsadmonitions"},
|
Features: []string{"mkdocsadmonitions"},
|
||||||
}
|
}
|
||||||
|
|
||||||
actual, _ := mark.CompileMarkdown(markdown, lib, filename, cfg)
|
actual, _ := mark.CompileMarkdown(markdown, lib, filename, cfg)
|
||||||
|
|||||||
@ -2,7 +2,7 @@ package renderer
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strconv"
|
||||||
|
|
||||||
parser "github.com/stefanfritsch/goldmark-admonitions"
|
parser "github.com/stefanfritsch/goldmark-admonitions"
|
||||||
"github.com/yuin/goldmark/ast"
|
"github.com/yuin/goldmark/ast"
|
||||||
@ -116,8 +116,7 @@ func (r *ConfluenceMkDocsAdmonitionRenderer) renderMkDocsAdmonition(writer util.
|
|||||||
return ast.WalkStop, err
|
return ast.WalkStop, err
|
||||||
}
|
}
|
||||||
|
|
||||||
title := strings.Trim(string(n.Title), "\"")
|
title, _ := strconv.Unquote(string(n.Title))
|
||||||
|
|
||||||
if title != "" {
|
if title != "" {
|
||||||
titleHTML := fmt.Sprintf("<p><strong>%s</strong></p>\n", title)
|
titleHTML := fmt.Sprintf("<p><strong>%s</strong></p>\n", title)
|
||||||
if _, err := writer.Write([]byte(titleHTML)); err != nil {
|
if _, err := writer.Write([]byte(titleHTML)); err != nil {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user