-
Notifications
You must be signed in to change notification settings - Fork 290
Open
Description
Steps to reproduce
Using flexmark to parse the following markdown:
This is a sentence.
```python
def C(m, n):
k = 1
l = 1
for i in range(n):
k *= m - i
l *= i + 1
return round(k / l)
The markdown should render as:
<p>This is a sentence.</p>
<pre><code class="language-python">def C(m, n):
k = 1
l = 1
for i in range(n):
k *= m - i
l *= i + 1
return round(k / l)
</code></pre>
Actual behavior
The code block is rendered incorrectly. The output contains unexpected nested <pre><code> tags and the formatting is broken:
<p>This is a sentence.</p>
<pre><code class="language-python">def C(m, n):
k = 1
l = 1
<pre><code>for i in range(n):
k *= m - i
l *= i + 1
return round(k / l)
</code></pre>
<p></code></pre></p>
Additional notes
- When there is no text before the code block, rendering is correct.
- The issue only appears when a line of text precedes the code block.
- Version: 0.64.8
- Code used to render:
private static String markToHTML(String markdown) {
Parser parser = Parser.builder().build();
HtmlRenderer renderer = HtmlRenderer.builder()
.escapeHtml(false)
.build();
Node document = parser.parse(markdown);
return renderer.render(document);
}
Metadata
Metadata
Assignees
Labels
No labels