From 587f4ff7152dbf82b39f0d9afc61be7a16570686 Mon Sep 17 00:00:00 2001 From: Anhgelus Morhtuuzh Date: Mon, 15 Dec 2025 17:38:35 +0100 Subject: fix(markdown): adding linebreak at the beginning in multiline code block create tests for code --- markdown/ast_code_test.go | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 markdown/ast_code_test.go (limited to 'markdown/ast_code_test.go') diff --git a/markdown/ast_code_test.go b/markdown/ast_code_test.go new file mode 100644 index 0000000..b116544 --- /dev/null +++ b/markdown/ast_code_test.go @@ -0,0 +1,33 @@ +package markdown + +import "testing" + +func TestCode(t *testing.T) { + got, err := Parse("`mono`", nil) + if err != nil { + t.Fatal(err) + } + if string(got) != `

mono

` { + t.Errorf("invalid value, got %s", got) + } + + got, err = Parse("bonjour `code` !", nil) + if err != nil { + t.Fatal(err) + } + if string(got) != `

bonjour code !

` { + t.Errorf("invalid value, got %s", got) + } + + got, err = Parse( + "```\n"+"raw\nhehe"+"```", + nil, + ) + if err != nil { + t.Fatal(err) + } + if string(got) != `
raw
+hehe
` { + t.Errorf("invalid value, got %s", got) + } +} -- cgit v1.2.3