Browse Source

Fix blockquote termination inside indented lists

close https://github.com/markdown-it/markdown-it/issues/329
pull/343/head
Alex Kocharin 7 years ago
parent
commit
f0e7e562ea
  1. 16
      lib/rules_block/blockquote.js
  2. 21
      test/fixtures/markdown-it/commonmark_extras.txt

16
lib/rules_block/blockquote.js

@ -212,7 +212,21 @@ module.exports = function blockquote(state, startLine, endLine, silent) {
break;
}
}
if (terminate) { break; }
if (terminate) {
if (oldIndent !== 0) {
// state.blkIndent was non-zero, we now set it to zero,
// so we need to re-calculate all offsets to appear as
// if indent wasn't changed
oldBMarks.push(state.bMarks[nextLine]);
oldBSCount.push(state.bsCount[nextLine]);
oldTShift.push(state.tShift[nextLine]);
oldSCount.push(state.sCount[nextLine]);
state.sCount[nextLine] -= oldIndent;
}
break;
}
oldBMarks.push(state.bMarks[nextLine]);
oldBSCount.push(state.bsCount[nextLine]);

21
test/fixtures/markdown-it/commonmark_extras.txt

@ -112,6 +112,27 @@ Regression test (code block + regular paragraph)
</blockquote>
.
Blockquotes inside indented lists should terminate correctly
.
- a
> b
```
c
```
- d
.
<ul>
<li>a
<blockquote>
<p>b</p>
</blockquote>
<pre><code>c
</code></pre>
</li>
<li>d</li>
</ul>
.
Don't output empty class here:
.
```&#x20;

Loading…
Cancel
Save