mirror of
https://github.com/yuin/goldmark
synced 2025-03-04 23:04:52 +00:00
parent
d44b18596f
commit
f6e93ffd8f
4 changed files with 36 additions and 7 deletions
|
|
@ -684,3 +684,22 @@ This line will be displayed.
|
||||||
<video autoplay muted loop>\r\n<source src=\"https://example.com/example.mp4\" type=\"video/mp4\">\r\nYour browser does not support the video tag.\r\n</video>
|
<video autoplay muted loop>\r\n<source src=\"https://example.com/example.mp4\" type=\"video/mp4\">\r\nYour browser does not support the video tag.\r\n</video>
|
||||||
//= = = = = = = = = = = = = = = = = = = = = = = =//
|
//= = = = = = = = = = = = = = = = = = = = = = = =//
|
||||||
|
|
||||||
|
|
||||||
|
53: HTML comment without trailing new lines
|
||||||
|
OPTIONS: {"trim": true}
|
||||||
|
//- - - - - - - - -//
|
||||||
|
<!--
|
||||||
|
-->
|
||||||
|
//- - - - - - - - -//
|
||||||
|
<!--
|
||||||
|
-->
|
||||||
|
//= = = = = = = = = = = = = = = = = = = = = = = =//
|
||||||
|
|
||||||
|
|
||||||
|
54: Escaped characters followed by a null character
|
||||||
|
OPTIONS: {"enableEscape": true}
|
||||||
|
//- - - - - - - - -//
|
||||||
|
\\\x00\"
|
||||||
|
//- - - - - - - - -//
|
||||||
|
<p>\\\ufffd"</p>
|
||||||
|
//= = = = = = = = = = = = = = = = = = = = = = = =//
|
||||||
|
|
|
||||||
|
|
@ -201,7 +201,7 @@ func (b *htmlBlockParser) Continue(node ast.Node, reader text.Reader, pc Context
|
||||||
}
|
}
|
||||||
if bytes.Contains(line, closurePattern) {
|
if bytes.Contains(line, closurePattern) {
|
||||||
htmlBlock.ClosureLine = segment
|
htmlBlock.ClosureLine = segment
|
||||||
reader.Advance(segment.Len() - 1)
|
reader.Advance(segment.Len())
|
||||||
return Close
|
return Close
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -743,6 +743,7 @@ func (d *defaultWriter) Write(writer util.BufWriter, source []byte) {
|
||||||
d.RawWrite(writer, source[n:i])
|
d.RawWrite(writer, source[n:i])
|
||||||
d.RawWrite(writer, replacementCharacter)
|
d.RawWrite(writer, replacementCharacter)
|
||||||
n = i + 1
|
n = i + 1
|
||||||
|
escaped = false
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if c == '&' {
|
if c == '&' {
|
||||||
|
|
|
||||||
|
|
@ -35,22 +35,31 @@ type MarkdownTestCase struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func source(t *MarkdownTestCase) string {
|
func source(t *MarkdownTestCase) string {
|
||||||
if t.Options.EnableEscape {
|
ret := t.Markdown
|
||||||
return string(applyEscapeSequence([]byte(t.Markdown)))
|
if t.Options.Trim {
|
||||||
|
ret = strings.TrimSpace(ret)
|
||||||
}
|
}
|
||||||
return t.Markdown
|
if t.Options.EnableEscape {
|
||||||
|
return string(applyEscapeSequence([]byte(ret)))
|
||||||
|
}
|
||||||
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
func expected(t *MarkdownTestCase) string {
|
func expected(t *MarkdownTestCase) string {
|
||||||
if t.Options.EnableEscape {
|
ret := t.Expected
|
||||||
return string(applyEscapeSequence([]byte(t.Expected)))
|
if t.Options.Trim {
|
||||||
|
ret = strings.TrimSpace(ret)
|
||||||
}
|
}
|
||||||
return t.Expected
|
if t.Options.EnableEscape {
|
||||||
|
return string(applyEscapeSequence([]byte(ret)))
|
||||||
|
}
|
||||||
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarkdownTestCaseOptions represents options for each test case.
|
// MarkdownTestCaseOptions represents options for each test case.
|
||||||
type MarkdownTestCaseOptions struct {
|
type MarkdownTestCaseOptions struct {
|
||||||
EnableEscape bool
|
EnableEscape bool
|
||||||
|
Trim bool
|
||||||
}
|
}
|
||||||
|
|
||||||
const attributeSeparator = "//- - - - - - - - -//"
|
const attributeSeparator = "//- - - - - - - - -//"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue