chore: implement html renderer

This commit is contained in:
Steven
2023-12-14 00:04:20 +08:00
parent 43ef9eaced
commit 5266a62685
5 changed files with 103 additions and 12 deletions

View File

@ -57,9 +57,9 @@ func TestParser(t *testing.T) {
&ast.Text{
Content: "!",
},
&ast.LineBreak{},
},
},
&ast.LineBreak{},
&ast.Paragraph{
Children: []ast.Node{
&ast.Text{
@ -84,15 +84,36 @@ func TestParser(t *testing.T) {
&ast.Text{
Content: "!",
},
&ast.LineBreak{},
},
},
&ast.LineBreak{},
&ast.CodeBlock{
Language: "javascript",
Content: "console.log(\"Hello world!\");",
},
},
},
{
text: "Hello world!\n\nNew paragraph.",
nodes: []ast.Node{
&ast.Paragraph{
Children: []ast.Node{
&ast.Text{
Content: "Hello world!",
},
&ast.LineBreak{},
},
},
&ast.LineBreak{},
&ast.Paragraph{
Children: []ast.Node{
&ast.Text{
Content: "New paragraph.",
},
},
},
},
},
}
for _, test := range tests {