goldmark icon indicating copy to clipboard operation
goldmark copied to clipboard

Rogue tildes rendering of a fenced code block within a list

Open soypat opened this issue 2 years ago • 1 comments

  1. What version of goldmark are you using? : 1.4.14
  2. What version of Go are you using? : go 1.19
  3. What operating system and processor architecture are you using? : linux amd64
  4. What did you do? : Tried to render the following markdown.
1. 
	```
	```
  1. What did you expect to see? :
<ol>
<li>
<pre><code></code></pre>
</li>
</ol>
  1. What did you see instead? : rogue tildes
<ol>
<li>
<pre><code></code></pre>
``</li>
</ol>
  1. Did you confirm your output is different from CommonMark online demo or other official renderer correspond with an extension?: Yes.

soypat avatar Sep 04 '22 21:09 soypat

go 1.19
require github.com/yuin/goldmark v1.4.14
package _test

import (
	"github.com/yuin/goldmark"
	"os"
	"strings"
)

func Example_convert() {
	m := goldmark.New()
	source := `
1.
	aaa
	aaa
`
	source = strings.ReplaceAll(source, "aaa", "```")

	_ = m.Convert([]byte(source), os.Stdout)
	// Output:
	// <ol>
	// <li>
	// <pre><code></code></pre>
	// </li>
	// </ol>
}

output:

=== RUN   Example_convert
--- FAIL: Example_convert (0.00s)
got:
<ol>
<li>
<pre><code></code></pre>
``</li>
</ol>
want:
<ol>
<li>
<pre><code></code></pre>
</li>
</ol>

FAIL

CarsonSlovoka avatar Sep 14 '22 07:09 CarsonSlovoka