aboutsummaryrefslogtreecommitdiff
path: root/markdown/ast_external_test.go
blob: feec6b230a8740d47b736b86921e18f752fc53ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package markdown

import "testing"

func TestExternal(t *testing.T) {
	t.Run("link", func(t *testing.T) {
		t.Run("simple", test("[content](href)", `<p><a href="href">content</a></p>`))
		t.Run("combo", test("Hey, [link](href)", `<p>Hey, <a href="href">link</a></p>`))
	})
	t.Run("image", func(t *testing.T) {
		t.Run("simple", test("![image alt](image src)", `<figure><img alt="image alt" src="image src"></figure>`))
		t.Run("combo", test(`
Avant la source
![image alt](image src)
source 1
source 2

Hors de la source
`, `<p>Avant la source</p><figure><img alt="image alt" src="image src"><figcaption>source 1 source 2</figcaption></figure><p>Hors de la source</p>`))
	})
}