mirror of
https://github.com/discourse/discourse.git
synced 2025-03-23 12:05:43 +08:00
FIX: Code blocks were trimming leading spaces sometimes when they should have only
trimmed trailing spaces.
This commit is contained in:
parent
093ead7855
commit
5e286443a8
@ -61,7 +61,7 @@ Discourse.Dialect.on("register", function(event) {
|
||||
next.unshift(MD.mk_block(n[2]));
|
||||
}
|
||||
|
||||
codeContents.push(n[1].trim());
|
||||
codeContents.push(n[1].replace(/\s+$/, ""));
|
||||
break;
|
||||
} else {
|
||||
codeContents.push(b);
|
||||
|
@ -217,6 +217,10 @@ test("Code Blocks", function() {
|
||||
cooked(" ```\n hello\n ```",
|
||||
"<pre><code>```\nhello\n```</code></pre>",
|
||||
"only detect ``` at the begining of lines");
|
||||
|
||||
cooked("```ruby\ndef self.parse(text)\n\n text\nend\n```",
|
||||
"<p><pre><code class=\"ruby\">def self.parse(text)\n\n text\nend</code></pre></p>",
|
||||
"it allows leading spaces on lines in a code block.");
|
||||
});
|
||||
|
||||
test("SanitizeHTML", function() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user