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

@ -18,6 +18,10 @@ func TestParagraphParser(t *testing.T) {
text: "",
paragraph: nil,
},
{
text: "\n",
paragraph: nil,
},
{
text: "Hello world!",
paragraph: &ast.Paragraph{
@ -28,6 +32,28 @@ func TestParagraphParser(t *testing.T) {
},
},
},
{
text: "Hello world!\n",
paragraph: &ast.Paragraph{
Children: []ast.Node{
&ast.Text{
Content: "Hello world!",
},
&ast.LineBreak{},
},
},
},
{
text: "Hello world!\n\nNew paragraph.",
paragraph: &ast.Paragraph{
Children: []ast.Node{
&ast.Text{
Content: "Hello world!",
},
&ast.LineBreak{},
},
},
},
}
for _, test := range tests {