From bdc867d153b952f0b0825b094960c3833c860aa5 Mon Sep 17 00:00:00 2001 From: Steven Date: Sat, 16 Dec 2023 09:12:55 +0800 Subject: [PATCH] fix: heading render --- plugin/gomark/render/html/html.go | 2 +- plugin/gomark/render/html/html_test.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/plugin/gomark/render/html/html.go b/plugin/gomark/render/html/html.go index ca67a52e..e8f4235a 100644 --- a/plugin/gomark/render/html/html.go +++ b/plugin/gomark/render/html/html.go @@ -96,7 +96,7 @@ func (r *HTMLRender) renderCodeBlock(node *ast.CodeBlock) { } func (r *HTMLRender) renderHeading(node *ast.Heading) { - element := fmt.Sprintf("", node.Level) + element := fmt.Sprintf("h%d", node.Level) r.output.WriteString(fmt.Sprintf("<%s>", element)) r.RenderNodes(node.Children) r.output.WriteString(fmt.Sprintf("", element)) diff --git a/plugin/gomark/render/html/html_test.go b/plugin/gomark/render/html/html_test.go index f497af45..d7a3409e 100644 --- a/plugin/gomark/render/html/html_test.go +++ b/plugin/gomark/render/html/html_test.go @@ -18,6 +18,10 @@ func TestHTMLRender(t *testing.T) { text: "Hello world!", expected: `

Hello world!

`, }, + { + text: "# Hello world!", + expected: `

Hello world!

`, + }, { text: "> Hello\n> world!", expected: `
Hello
world!
`,