FIX: fix dialect block ordering

This commit is contained in:
Jens Maier 2014-09-10 12:59:21 +02:00
parent c80ef9e3fa
commit 30dbb570e5
2 changed files with 13 additions and 0 deletions

View File

@ -21,6 +21,11 @@ var parser = window.BetterMarkdown,
**/
function initializeDialects() {
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);
initialized = true;
}

View File

@ -379,6 +379,14 @@ test("Code Blocks", function() {
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>",
"it does not consume next block's trailing newlines");
cooked(" <pre>test</pre>",
"<pre><code>&lt;pre&gt;test&lt;/pre&gt;</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() {