FIX: fix dialect block ordering
This commit is contained in:
parent
c80ef9e3fa
commit
30dbb570e5
|
@ -21,6 +21,11 @@ var parser = window.BetterMarkdown,
|
||||||
**/
|
**/
|
||||||
function initializeDialects() {
|
function initializeDialects() {
|
||||||
MD.buildBlockOrder(dialect.block);
|
MD.buildBlockOrder(dialect.block);
|
||||||
|
var index = dialect.block.__order__.indexOf("code");
|
||||||
|
if (index > -1) {
|
||||||
|
dialect.block.__order__.splice(index, 1);
|
||||||
|
dialect.block.__order__.unshift("code");
|
||||||
|
}
|
||||||
MD.buildInlinePatterns(dialect.inline);
|
MD.buildInlinePatterns(dialect.inline);
|
||||||
initialized = true;
|
initialized = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -379,6 +379,14 @@ test("Code Blocks", function() {
|
||||||
cooked("```\nline1\n```\n```\nline2\n\nline3\n```",
|
cooked("```\nline1\n```\n```\nline2\n\nline3\n```",
|
||||||
"<p><pre><code class=\"lang-auto\">line1</code></pre></p>\n\n<p><pre><code class=\"lang-auto\">line2\n\nline3</code></pre></p>",
|
"<p><pre><code class=\"lang-auto\">line1</code></pre></p>\n\n<p><pre><code class=\"lang-auto\">line2\n\nline3</code></pre></p>",
|
||||||
"it does not consume next block's trailing newlines");
|
"it does not consume next block's trailing newlines");
|
||||||
|
|
||||||
|
cooked(" <pre>test</pre>",
|
||||||
|
"<pre><code><pre>test</pre></code></pre>",
|
||||||
|
"it does not parse other block types in markdown code blocks");
|
||||||
|
|
||||||
|
cooked(" [quote]test[/quote]",
|
||||||
|
"<pre><code>[quote]test[/quote]</code></pre>",
|
||||||
|
"it does not parse other block types in markdown code blocks");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("sanitize", function() {
|
test("sanitize", function() {
|
||||||
|
|
Loading…
Reference in New Issue