mirror of
https://github.com/usememos/memos.git
synced 2025-01-31 01:36:25 +08:00
fix: heading render
This commit is contained in:
parent
6421fbc68a
commit
bdc867d153
2 changed files with 5 additions and 1 deletions
|
@ -96,7 +96,7 @@ func (r *HTMLRender) renderCodeBlock(node *ast.CodeBlock) {
|
|||
}
|
||||
|
||||
func (r *HTMLRender) renderHeading(node *ast.Heading) {
|
||||
element := fmt.Sprintf("<h%d>", 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("</%s>", element))
|
||||
|
|
|
@ -18,6 +18,10 @@ func TestHTMLRender(t *testing.T) {
|
|||
text: "Hello world!",
|
||||
expected: `<p>Hello world!</p>`,
|
||||
},
|
||||
{
|
||||
text: "# Hello world!",
|
||||
expected: `<h1>Hello world!</h1>`,
|
||||
},
|
||||
{
|
||||
text: "> Hello\n> world!",
|
||||
expected: `<blockquote>Hello<br>world!</blockquote>`,
|
||||
|
|
Loading…
Reference in a new issue