mirror of
https://github.com/markedjs/marked.git
synced 2026-11-30 16:48:05 +01:00
fix: stop an unclosed inline raw tag from unescaping later blocks (#4130)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
f0fd3e0e22
commit
4562b6f979
@@ -103,6 +103,10 @@ export class _Lexer<ParserOutput = string, RendererOutput = string> {
|
||||
|
||||
for (let i = 0; i < this.inlineQueue.length; i++) {
|
||||
const next = this.inlineQueue[i];
|
||||
// an inline <pre>, <code>, <kbd> or <script> left open ends with the block
|
||||
// holding it; carried over, it would stop every later block's text from
|
||||
// being escaped
|
||||
this.state.inRawBlock = false;
|
||||
this.inlineTokens(next.src, next.tokens);
|
||||
}
|
||||
this.inlineQueue = [];
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<p>an unclosed <code> tag</p>
|
||||
<p>does not leak into the next paragraph: 1 < 2 & 3 > 2</p>
|
||||
<p>an unclosed <pre> tag</p>
|
||||
<h1>does not leak into a heading: 1 < 2 & 3 > 2</h1>
|
||||
<p>an unclosed <kbd> tag</p>
|
||||
<ul>
|
||||
<li>does not leak into a list item: 1 < 2 & 3 > 2</li>
|
||||
</ul>
|
||||
<p>within a paragraph <code>a & b</code> is still raw, as is
|
||||
<code>a & b
|
||||
across a line</code> but not after it: 1 < 2</p>
|
||||
@@ -0,0 +1,18 @@
|
||||
---
|
||||
renderExact: true
|
||||
---
|
||||
an unclosed <code> tag
|
||||
|
||||
does not leak into the next paragraph: 1 < 2 & 3 > 2
|
||||
|
||||
an unclosed <pre> tag
|
||||
|
||||
# does not leak into a heading: 1 < 2 & 3 > 2
|
||||
|
||||
an unclosed <kbd> tag
|
||||
|
||||
- does not leak into a list item: 1 < 2 & 3 > 2
|
||||
|
||||
within a paragraph <code>a & b</code> is still raw, as is
|
||||
<code>a & b
|
||||
across a line</code> but not after it: 1 < 2
|
||||
Reference in New Issue
Block a user