aboutsummaryrefslogtreecommitdiff
path: root/markdown/ast_paragraph_test.go
diff options
context:
space:
mode:
authorAnhgelus Morhtuuzh <william@herges.fr>2025-12-14 18:05:35 +0100
committerAnhgelus Morhtuuzh <william@herges.fr>2025-12-14 18:05:35 +0100
commita65b9cb6b2c7dc7b48b8076d5e463776f1de0cf1 (patch)
tree021a5d38fe1a6c9bd876114fd3b3f4a296737fbd /markdown/ast_paragraph_test.go
parent8edad5f9aee4625384485ad07180da751858839c (diff)
feat(markdown): custom replacer
Diffstat (limited to 'markdown/ast_paragraph_test.go')
-rw-r--r--markdown/ast_paragraph_test.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/markdown/ast_paragraph_test.go b/markdown/ast_paragraph_test.go
index 46dd714..2014ab9 100644
--- a/markdown/ast_paragraph_test.go
+++ b/markdown/ast_paragraph_test.go
@@ -11,3 +11,23 @@ func TestParagraph(t *testing.T) {
t.Errorf("failed, got %s", c)
}
}
+
+func TestParagraph_Replacer(t *testing.T) {
+ opt := &Option{
+ Replaces: map[rune]string{'~': "&thinsp;"},
+ }
+ c, err := Parse("bonsoir", opt)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if c != "<p>bonsoir</p>" {
+ t.Errorf("failed, got %s", c)
+ }
+ c, err = Parse("bonsoir~!", opt)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if c != "<p>bonsoir&thinsp;!</p>" {
+ t.Errorf("failed, got %s", c)
+ }
+}