mirror of
https://github.com/yuin/goldmark
synced 2025-03-04 23:04:52 +00:00
Fixed bug related newline code
This commit is contained in:
parent
ae42b9179f
commit
c71a97b837
2 changed files with 38 additions and 17 deletions
|
|
@ -176,4 +176,25 @@ func TestEastAsianLineBreaks(t *testing.T) {
|
|||
},
|
||||
t,
|
||||
)
|
||||
|
||||
markdown = goldmark.New(goldmark.WithRendererOptions(
|
||||
html.WithXHTML(),
|
||||
html.WithUnsafe(),
|
||||
),
|
||||
goldmark.WithExtensions(
|
||||
NewCJK(WithEastAsianLineBreaks()),
|
||||
Linkify,
|
||||
),
|
||||
)
|
||||
no = 7
|
||||
testutil.DoTestCase(
|
||||
markdown,
|
||||
testutil.MarkdownTestCase{
|
||||
No: no,
|
||||
Description: "WithEastAsianLineBreaks and linkfy extension",
|
||||
Markdown: "太郎は\\ **「こんにちわ」**\\ と言った\r\nんです",
|
||||
Expected: "<p>太郎は\\ <strong>「こんにちわ」</strong>\\ と言ったんです</p>",
|
||||
},
|
||||
t,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1178,7 +1178,7 @@ func (p *parser) parseBlock(block text.BlockReader, parent ast.Node, pc Context)
|
|||
if c == '\n' {
|
||||
break
|
||||
}
|
||||
isSpace := util.IsSpace(c)
|
||||
isSpace := util.IsSpace(c) && c != '\r' && c != '\n'
|
||||
isPunct := util.IsPunct(c)
|
||||
if (isPunct && !escaped) || isSpace && !(escaped && p.escapedSpace) || i == 0 {
|
||||
parserChar := c
|
||||
|
|
|
|||
Loading…
Reference in a new issue