mirror of
https://github.com/markedjs/marked.git
synced 2026-11-30 16:48:05 +01:00
fix: strip a tab that follows spaces in an indented code block (#4080)
* fix: strip a tab that follows spaces in an indented code block codeRemoveIndent tried its space alternative first, so a line indented with spaces then a tab lost only the spaces and kept the tab as content. Trying the tab alternative first matches CommonMark example 2, where a tab advances to the next four column stop and the whole run is indent. * test: move the tab tests to test/specs/new Uses renderExact so the fixture compares exactly, which htmlIsEqual does not, and keeps the assertions out of marked.test.js.
This commit is contained in:
+1
-1
@@ -41,7 +41,7 @@ try {
|
||||
})();
|
||||
|
||||
export const other = {
|
||||
codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm,
|
||||
codeRemoveIndent: /^(?: {0,3}\t| {1,4})/gm,
|
||||
outputLinkReplace: /\\([\[\]])/g,
|
||||
indentCodeCompensation: /^(\s+)(?:```)/,
|
||||
beginningSpace: /^\s+/,
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<pre><code>foo baz bim
|
||||
</code></pre>
|
||||
<p>sep</p>
|
||||
<pre><code>three spaces and a tab
|
||||
</code></pre>
|
||||
<p>sep</p>
|
||||
<pre><code>lone tab
|
||||
</code></pre>
|
||||
<p>sep</p>
|
||||
<pre><code>four spaces
|
||||
</code></pre>
|
||||
<p>sep</p>
|
||||
<pre><code> five spaces
|
||||
</code></pre>
|
||||
@@ -0,0 +1,20 @@
|
||||
---
|
||||
renderExact: true
|
||||
---
|
||||
foo baz bim
|
||||
|
||||
sep
|
||||
|
||||
three spaces and a tab
|
||||
|
||||
sep
|
||||
|
||||
lone tab
|
||||
|
||||
sep
|
||||
|
||||
four spaces
|
||||
|
||||
sep
|
||||
|
||||
five spaces
|
||||
Reference in New Issue
Block a user