markup/goldmark: Update the CJK extension to allow specifying line break styles

This commit follows https://github.com/yuin/goldmark/pull/411
This commit is contained in:
OMOTO Tsukasa
2023-10-29 18:13:56 +09:00
committed by GitHub
parent 3f64b5a3de
commit db14238ba3
5 changed files with 69 additions and 7 deletions

View File

@@ -675,6 +675,60 @@ eastAsianLineBreaks=true
c.Assert(got, qt.Contains, "<p>私は太郎です。プログラミングが好きで、運動が苦手です。</p>\n")
}
func TestConvertCJKWithExtensionWithEastAsianLineBreaksOptionWithSimple(t *testing.T) {
c := qt.New(t)
content := `
私は太郎です。
Programming が好きで、
運動が苦手です。
`
confStr := `
[markup]
[markup.goldmark]
[markup.goldmark.extensions.CJK]
enable=true
eastAsianLineBreaks=true
eastAsianLineBreaksStyle="simple"
`
cfg := config.FromTOMLConfigString(confStr)
conf := testconfig.GetTestConfig(nil, cfg)
b := convert(c, conf, content)
got := string(b.Bytes())
c.Assert(got, qt.Contains, "<p>私は太郎です。\nProgramming が好きで、運動が苦手です。</p>\n")
}
func TestConvertCJKWithExtensionWithEastAsianLineBreaksOptionWithStyle(t *testing.T) {
c := qt.New(t)
content := `
私は太郎です。
Programming が好きで、
運動が苦手です。
`
confStr := `
[markup]
[markup.goldmark]
[markup.goldmark.extensions.CJK]
enable=true
eastAsianLineBreaks=true
eastAsianLineBreaksStyle="css3draft"
`
cfg := config.FromTOMLConfigString(confStr)
conf := testconfig.GetTestConfig(nil, cfg)
b := convert(c, conf, content)
got := string(b.Bytes())
c.Assert(got, qt.Contains, "<p>私は太郎です。Programming が好きで、運動が苦手です。</p>\n")
}
func TestConvertCJKWithExtensionWithEscapedSpaceOption(t *testing.T) {
c := qt.New(t)