From a65b9cb6b2c7dc7b48b8076d5e463776f1de0cf1 Mon Sep 17 00:00:00 2001 From: Anhgelus Morhtuuzh Date: Sun, 14 Dec 2025 18:05:35 +0100 Subject: feat(markdown): custom replacer --- markdown/ast_paragraph_test.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'markdown/ast_paragraph_test.go') 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{'~': " "}, + } + c, err := Parse("bonsoir", opt) + if err != nil { + t.Fatal(err) + } + if c != "

bonsoir

" { + t.Errorf("failed, got %s", c) + } + c, err = Parse("bonsoir~!", opt) + if err != nil { + t.Fatal(err) + } + if c != "

bonsoir !

" { + t.Errorf("failed, got %s", c) + } +} -- cgit v1.2.3