mirror of
https://github.com/danog/blackfriday.git
synced 2024-11-30 04:29:13 +01:00
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.
This commit is contained in:
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.
|
||||
func (p *parser) fencedCodeBlock(out *bytes.Buffer, data []byte, doRender bool) int {
|
||||
var syntax string
|
||||
beg, marker := isFenceLine(data, &syntax, "", true)
|
||||
beg, marker := isFenceLine(data, &syntax, "", false)
|
||||
if beg == 0 || beg >= len(data) {
|
||||
return 0
|
||||
}
|
||||
|
@ -1661,6 +1661,12 @@ func TestIsFenceLine(t *testing.T) {
|
||||
wantEnd: 4,
|
||||
wantMarker: "```",
|
||||
},
|
||||
{
|
||||
data: []byte("```\nstuff here\n"),
|
||||
syntaxRequested: true,
|
||||
wantEnd: 4,
|
||||
wantMarker: "```",
|
||||
},
|
||||
{
|
||||
data: []byte("stuff here\n```\n"),
|
||||
wantEnd: 0,
|
||||
|
Loading…
Reference in New Issue
Block a user