Merge pull request #2778 from Elberet/fix-parser-block-ordering

FIX: fix dialect block ordering
This commit is contained in:
Sam 2014-09-11 08:14:17 +10:00
commit fd29fe503d
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() {