Support 1-3 spaces prefixing a code fence per specification (fixes #107).

This commit is contained in:
David Anson 2018-03-06 21:43:45 -08:00
parent 40ace5bb5e
commit 89e12b90e0
3 changed files with 46 additions and 1 deletions

View file

@ -141,7 +141,7 @@ function makeTokenCache(params) {
// Find fenced code by pattern (parser ignores "``` close fence")
params.lines.forEach(function forLine(line, lineIndex) {
var metadata = 0;
var match = /^(`{3,}|~{3,})/.exec(line);
var match = /^[ ]{0,3}(`{3,}|~{3,})/.exec(line);
var fence = match && match[1];
if (fence &&
(!inFence || (fence.substr(0, fenceStart.length) === fenceStart))) {