diff options
| author | Anhgelus Morhtuuzh <william@herges.fr> | 2025-09-30 21:43:03 +0200 |
|---|---|---|
| committer | Anhgelus Morhtuuzh <william@herges.fr> | 2025-09-30 21:43:03 +0200 |
| commit | 0426dfc21a0808a25404d3f03d36d1ce4e2efde7 (patch) | |
| tree | 43188d2326aa8da14c14cd485ff2dfbf1806b6cd /mardown | |
| parent | 96f395276f524105ff281c40413c883b55d3e9da (diff) | |
fix(markdown): missing code in valid modifier type
Diffstat (limited to 'mardown')
| -rw-r--r-- | mardown/ast_modifier.go | 2 | ||||
| -rw-r--r-- | mardown/ast_test.go | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/mardown/ast_modifier.go b/mardown/ast_modifier.go index 7437ab8..a9039ce 100644 --- a/mardown/ast_modifier.go +++ b/mardown/ast_modifier.go @@ -62,7 +62,7 @@ func modifier(lxs *lexers) (*astModifier, error) { switch lxs.Current().Type { case lexerLiteral: s += lxs.Current().Value - case lexerModifier: + case lexerModifier, lexerCode: n := len(modInside.symbols) if len(lxs.Current().Value) < n { return nil, ErrInvalidModifier diff --git a/mardown/ast_test.go b/mardown/ast_test.go index 6712497..b270b18 100644 --- a/mardown/ast_test.go +++ b/mardown/ast_test.go @@ -31,4 +31,18 @@ func TestAst(t *testing.T) { t.Errorf("failed, got %s", c) t.Logf("lxs: %s\ntree: %s", lxs, tree) } + content = "je suis un `code`" + lxs = lex(content) + tree, err = ast(lxs) + if err != nil { + t.Fatal(err) + } + c, err = tree.Eval() + if err != nil { + t.Fatal(err) + } + if c != "<p>je suis un <code>code</code></p>" { + t.Errorf("failed, got %s", c) + t.Logf("lxs: %s\ntree: %s", lxs, tree) + } } |
