aboutsummaryrefslogtreecommitdiff
path: root/markdown/ast_modifier.go
diff options
context:
space:
mode:
authorAnhgelus Morhtuuzh <william@herges.fr>2025-12-13 17:15:47 +0000
committerAnhgelus Morhtuuzh <william@herges.fr>2025-12-13 17:15:47 +0000
commit62fa3f77e8215fdaaf72ddb9df4162e0d65148da (patch)
treedbf20dca933996cf253fe2d110d8381b0c407b2d /markdown/ast_modifier.go
parentae297bbd117835304b298e7d8a2f914111940e77 (diff)
parent48311424ba2eaac254864c008b6d18e8510f827d (diff)
Merge pull request '[Refactor] Replace manual DOM manipulation in markdown by cleaner one' (#2) from refactor/mardown-dom into main
Reviewed-on: https://git.anhgelus.world/anhgelus/small-web/pulls/2
Diffstat (limited to 'markdown/ast_modifier.go')
-rw-r--r--markdown/ast_modifier.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/markdown/ast_modifier.go b/markdown/ast_modifier.go
index 909d25e..7672c0c 100644
--- a/markdown/ast_modifier.go
+++ b/markdown/ast_modifier.go
@@ -5,6 +5,8 @@ import (
"errors"
"fmt"
"html/template"
+
+ "git.anhgelus.world/anhgelus/small-web/dom"
)
var (
@@ -38,7 +40,7 @@ func (a *astModifier) Eval(opt *Option) (template.HTML, *ParseError) {
if a.super {
return content, nil
}
- return template.HTML(fmt.Sprintf("<%s>%s</%s>", a.tag, content, a.tag)), nil
+ return dom.NewLiteralContentElement(string(a.tag), content).Render(), nil
}
func (a *astModifier) String() string {
@@ -66,7 +68,7 @@ func modifier(lxs *lexers) (*astModifier, error) {
var s string
for lxs.Next() {
switch lxs.Current().Type {
- case lexerLiteral, lexerHeader, lexerList:
+ case lexerLiteral, lexerHeading, lexerList:
s += lxs.Current().Value
case lexerModifier:
if mod.super && []rune(mod.symbols)[0] == []rune(lxs.Current().Value)[0] &&