markup/goldmark: Add CJK extension

Fixes #10472
This commit is contained in:
OMOTO Tsukasa
2023-08-30 20:08:45 +09:00
committed by GitHub
parent 9bf76fd7e8
commit d7dcc76d27
4 changed files with 106 additions and 0 deletions

View File

@@ -136,6 +136,19 @@ func newMarkdown(pcfg converter.ProviderConfig) goldmark.Markdown {
extensions = append(extensions, extension.Footnote)
}
if cfg.Extensions.CJK.Enable {
opts := []extension.CJKOption{}
if cfg.Extensions.CJK.EastAsianLineBreaks {
opts = append(opts, extension.WithEastAsianLineBreaks())
}
if cfg.Extensions.CJK.EscapedSpace {
opts = append(opts, extension.WithEscapedSpace())
}
c := extension.NewCJK(opts...)
extensions = append(extensions, c)
}
if cfg.Parser.AutoHeadingID {
parserOptions = append(parserOptions, parser.WithAutoHeadingID())
}