Skip to content

Commit

Permalink
chore: update html element node renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyjoygh committed Jul 14, 2024
1 parent e5b687d commit 35ed01b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions renderer/html/html.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ func (r *HTMLRenderer) RenderNode(node ast.Node) {
r.renderReferencedContent(n)
case *ast.Spoiler:
r.renderSpoiler(n)
case *ast.HTMLElement:
r.renderHTMLElement(n)
default:
// Handle other block types if needed.
}
Expand Down Expand Up @@ -341,3 +343,7 @@ func (r *HTMLRenderer) renderSpoiler(node *ast.Spoiler) {
r.output.WriteString(node.Content)
r.output.WriteString("</summary></details>")
}

func (r *HTMLRenderer) renderHTMLElement(node *ast.HTMLElement) {
r.output.WriteString(fmt.Sprintf("<%s >", node.TagName))
}
6 changes: 6 additions & 0 deletions renderer/string/string.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ func (r *StringRenderer) RenderNode(node ast.Node) {
r.renderReferencedContent(n)
case *ast.Spoiler:
r.renderSpoiler(n)
case *ast.HTMLElement:
r.renderHTMLElement(n)
default:
// Handle other block types if needed.
}
Expand Down Expand Up @@ -246,3 +248,7 @@ func (*StringRenderer) renderReferencedContent(_ *ast.ReferencedContent) {}
func (r *StringRenderer) renderSpoiler(node *ast.Spoiler) {
r.output.WriteString(node.Content)
}

func (r *StringRenderer) renderHTMLElement(*ast.HTMLElement) {
r.output.WriteString("\n")
}

0 comments on commit 35ed01b

Please sign in to comment.