Browse Source

Fenced code block info string should not contain fence marker

Fix https://github.com/markdown-it/markdown-it/issues/301
pull/306/head
Alex Kocharin 8 years ago
parent
commit
93544ee4bf
  1. 2
      lib/rules_block/fence.js
  2. 10
      test/fixtures/markdown-it/commonmark_extras.txt

2
lib/rules_block/fence.js

@ -28,7 +28,7 @@ module.exports = function fence(state, startLine, endLine, silent) {
markup = state.src.slice(mem, pos);
params = state.src.slice(pos, max);
if (params.indexOf('`') >= 0) { return false; }
if (params.indexOf(String.fromCharCode(marker)) >= 0) { return false; }
// Since start is found, we can report success here in validation mode
if (silent) { return true; }

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

@ -149,6 +149,16 @@ bar
</ul>
.
Info string in fenced code block can't contain marker used for the fence
.
~~~test~
~~~test`
.
<p>~~~test~</p>
<pre><code class="test`"></code></pre>
.
Coverage. Directive can terminate paragraph.
.
a

Loading…
Cancel
Save