blackfriday
blackfriday copied to clipboard
v2 is not wrapping code tags with pre tags so newlines are stripped from html
I used v1 with great results, but v2 seems broken with even the simplest of markdown
## Testing
```sh
line one
line two
Produces this...
sh line one line two
html output
<p>
<code>sh
line one
line two
</code></p>
here is the code I used in go
blackfriday.Run([]byte(args), blackfriday.WithExtensions(blackfriday.CommonExtensions))
I would expect code similar to this
<pre><code>line one
line two</code></pre>
Also, the sh
should be translated into a class:
<code class="language-sh>...</code>
I have the same problem. Were you able to figure out what's wrong ?
I found out the issue. https://github.com/russross/blackfriday/blob/3e56bb68c8876389c631e9e318ce3c092a0906db/block.go#L660
The code is looking for the character \n
explicitly.
In my case, the file "line separator" was set to Windows (\r\n)
so it found \r
instead, and was returning.
So the solution was to set the "line separator" to Unix & macOS (\n)
OR remove all the \r
in your file (with code)