russross / blackfriday

Blackfriday: a markdown processor for Go
Other
5.41k stars 596 forks source link

List convert error #693

Closed xiaotuanyu120 closed 2 years ago

xiaotuanyu120 commented 2 years ago

The Markdown Content

Some words here
- 1
- 2

Expectation

<p>Some words here</p>
<ul>
  <li>1</li>
  <li>2</li>
</ul>

But actually the output is

<p>Some words here - 1 - 2</p>

But it will worked if I add an empty line between the list and the sentence, just like this

Some words here

- 1
- 2

Is this by design or it‘s a bug?

xiaotuanyu120 commented 2 years ago

Found the solution:

        // Add blackfriday.NoEmptyLineBeforeBlock
        blackfriday.Run(
        []byte(md.Content),
        blackfriday.WithRenderer(r),
        blackfriday.WithExtensions(blackfriday.CommonExtensions|blackfriday.NoEmptyLineBeforeBlock),
    )