chore: update inline parser

This commit is contained in:
Steven
2023-12-16 10:09:20 +08:00
parent 7b0ceee57b
commit 47af632c79
19 changed files with 73 additions and 222 deletions

View File

@ -134,7 +134,7 @@ func (r *StringRender) renderText(node *ast.Text) {
}
func (r *StringRender) renderBold(node *ast.Bold) {
r.output.WriteString(node.Content)
r.RenderNodes(node.Children)
}
func (r *StringRender) renderItalic(node *ast.Italic) {
@ -151,12 +151,12 @@ func (r *StringRender) renderCode(node *ast.Code) {
r.output.WriteString("`")
}
func (*StringRender) renderImage(*ast.Image) {
// Do nothing.
func (r *StringRender) renderImage(node *ast.Image) {
r.output.WriteString(node.AltText)
}
func (*StringRender) renderLink(*ast.Link) {
// Do nothing.
func (r *StringRender) renderLink(node *ast.Link) {
r.output.WriteString(node.Text)
}
func (r *StringRender) renderTag(node *ast.Tag) {

View File

@ -22,6 +22,10 @@ func TestStringRender(t *testing.T) {
text: "**Hello** world!",
expected: `Hello world!`,
},
{
text: "**[your/slash](https://example.com)** world!",
expected: `your/slash world!`,
},
}
for _, test := range tests {