mirror of
https://github.com/discourse/discourse.git
synced 2024-11-28 03:33:58 -06:00
FIX: Markdown bug when a heading preceeded a code block.
This commit is contained in:
parent
25e5031fb1
commit
13bf8e1e46
@ -421,7 +421,12 @@ Discourse.Dialect = {
|
||||
// just give up if there's no stop tag in this or any next block
|
||||
args.stop.lastIndex = block.length - trailing.length;
|
||||
if (!args.stop.exec(block) && lastChance()) { return; }
|
||||
if (leading.length > 0) { result.push(['p'].concat(this.processInline(leading))); }
|
||||
if (leading.length > 0) {
|
||||
var parsedLeading = this.processBlock(MD.mk_block(leading), []);
|
||||
if (parsedLeading && parsedLeading[0]) {
|
||||
result.push(parsedLeading[0]);
|
||||
}
|
||||
}
|
||||
if (trailing.length > 0) {
|
||||
next.unshift(MD.mk_block(trailing, block.trailing,
|
||||
block.lineNumber + countLines(leading) + (match[2] ? match[2].length : 0) - trailing.length));
|
||||
|
@ -398,6 +398,8 @@ test("Code Blocks", function() {
|
||||
cooked(" [quote]test[/quote]",
|
||||
"<pre><code>[quote]test[/quote]</code></pre>",
|
||||
"it does not parse other block types in markdown code blocks");
|
||||
|
||||
cooked("## a\nb\n```\nc\n```", "<h2>a</h2>\n\n<p><pre><code class=\"lang-auto\">c</code></pre></p>", "it handles headings with code blocks after them.");
|
||||
});
|
||||
|
||||
test("sanitize", function() {
|
||||
|
Loading…
Reference in New Issue
Block a user