aboutsummaryrefslogtreecommitdiff
path: root/mardown/ast_external_test.go
diff options
context:
space:
mode:
authorAnhgelus Morhtuuzh <william@herges.fr>2025-10-02 12:03:06 +0200
committerAnhgelus Morhtuuzh <william@herges.fr>2025-10-02 12:03:15 +0200
commitcdb0a541554aa4a16fc71b6425225e8c603c83b8 (patch)
tree283fb876c55647235c2990cc42ed04e199f448f1 /mardown/ast_external_test.go
parentc176f81dc60d558edfe626ac805a0173c12f317d (diff)
feat(markdown): support external link and image (without source)
Diffstat (limited to 'mardown/ast_external_test.go')
-rw-r--r--mardown/ast_external_test.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/mardown/ast_external_test.go b/mardown/ast_external_test.go
new file mode 100644
index 0000000..fc0597d
--- /dev/null
+++ b/mardown/ast_external_test.go
@@ -0,0 +1,31 @@
+package mardown
+
+import "testing"
+
+func TestExternal(t *testing.T) {
+ lxs := lex("[content](href)")
+ tree, err := ast(lxs)
+ if err != nil {
+ t.Fatal(err)
+ }
+ got, err := tree.Eval()
+ if err != nil {
+ t.Fatal(err)
+ }
+ if string(got) != `<p><a href="href">content</a></p>` {
+ t.Errorf("invalid value, got %s", got)
+ }
+
+ lxs = lex("![image alt](image src)")
+ tree, err = ast(lxs)
+ if err != nil {
+ t.Fatal(err)
+ }
+ got, err = tree.Eval()
+ if err != nil {
+ t.Fatal(err)
+ }
+ if string(got) != `<figure><img alt="image alt" src="image src"></figure>` {
+ t.Errorf("invalid value, got %s", got)
+ }
+}