diff options
| author | Anhgelus Morhtuuzh <william@herges.fr> | 2025-09-30 21:40:34 +0200 |
|---|---|---|
| committer | Anhgelus Morhtuuzh <william@herges.fr> | 2025-09-30 21:40:34 +0200 |
| commit | 96f395276f524105ff281c40413c883b55d3e9da (patch) | |
| tree | 379808fc0dd5c6eff41a6864383cbf0a830a502b /mardown/ast_modifier.go | |
| parent | c4ba44b1c3e066f98ccc406c15a8c1de170e4709 (diff) | |
fix(markdown): invalid modifier organization
Diffstat (limited to 'mardown/ast_modifier.go')
| -rw-r--r-- | mardown/ast_modifier.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/mardown/ast_modifier.go b/mardown/ast_modifier.go index b9e53a1..7437ab8 100644 --- a/mardown/ast_modifier.go +++ b/mardown/ast_modifier.go @@ -57,13 +57,13 @@ func modifier(lxs *lexers) (*astModifier, error) { } } } - n := len(modInside.symbols) var s string for lxs.Next() { switch lxs.Current().Type { case lexerLiteral: s += lxs.Current().Value case lexerModifier: + n := len(modInside.symbols) if len(lxs.Current().Value) < n { return nil, ErrInvalidModifier } @@ -92,8 +92,13 @@ func modifierDetect(val string) *astModifier { return mod } if val[:2] == "**" || val[:2] == "__" { - mod.symbols = val + mod.symbols = val[:2] mod.tag = boldTag + if len(val) > 2 { + next := modifierDetect(val[2:]) + next.parent = mod + mod.content = append(mod.content, next) + } } else { mod = modifierDetect(val[:1]) next := modifierDetect(val[1:]) |
