Make newline mandatory for opening fence line. (#281)
This was an unintended typo/mistake in #280. This is stricter, and it's fine. The opening fence line will always need to have a newline. Add another test for isFenceLine.pull/283/head
parent
4e6f303e8d
commit
93622da34e
2
block.go
2
block.go
|
@ -664,7 +664,7 @@ func isFenceLine(data []byte, syntax *string, oldmarker string, newlineOptional
|
||||||
// If doRender is true, a final newline is mandatory to recognize the fenced code block.
|
// If doRender is true, a final newline is mandatory to recognize the fenced code block.
|
||||||
func (p *parser) fencedCodeBlock(out *bytes.Buffer, data []byte, doRender bool) int {
|
func (p *parser) fencedCodeBlock(out *bytes.Buffer, data []byte, doRender bool) int {
|
||||||
var syntax string
|
var syntax string
|
||||||
beg, marker := isFenceLine(data, &syntax, "", true)
|
beg, marker := isFenceLine(data, &syntax, "", false)
|
||||||
if beg == 0 || beg >= len(data) {
|
if beg == 0 || beg >= len(data) {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
|
@ -1661,6 +1661,12 @@ func TestIsFenceLine(t *testing.T) {
|
||||||
wantEnd: 4,
|
wantEnd: 4,
|
||||||
wantMarker: "```",
|
wantMarker: "```",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
data: []byte("```\nstuff here\n"),
|
||||||
|
syntaxRequested: true,
|
||||||
|
wantEnd: 4,
|
||||||
|
wantMarker: "```",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
data: []byte("stuff here\n```\n"),
|
data: []byte("stuff here\n```\n"),
|
||||||
wantEnd: 0,
|
wantEnd: 0,
|
||||||
|
|
Loading…
Reference in New Issue