mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 21:43:21 +00:00
Add newlines outside code blocks in marked.js to match bugdown
(imported from commit 7618260dbfa11209b3cc45d007407476897c2a20)
This commit is contained in:
@@ -339,12 +339,12 @@ $(function () {
|
||||
// We special-case the 'quote' language and output a blockquote
|
||||
r.code = function (code, lang) {
|
||||
if (lang === 'quote') {
|
||||
return '<blockquote><p>' + escape(code, true) + '</p></blockquote>';
|
||||
return '<blockquote>\n<p>' + escape(code, true) + '</p>\n</blockquote>\n\n\n';
|
||||
}
|
||||
|
||||
return '<div class="codehilite"><pre>'
|
||||
+ escape(code, true)
|
||||
+ '\n</pre></div>';
|
||||
+ '\n</pre></div>\n\n\n';
|
||||
};
|
||||
|
||||
// Our links have title= and target=_blank
|
||||
|
||||
@@ -16,13 +16,13 @@
|
||||
"name": "codeblock_multiline",
|
||||
"input": "Hamlet once said\n~~~~\ndef func():\n x = 1\n\n y = 2\n\n z = 3\n~~~~\nAnd all was good.",
|
||||
"expected_output": "<p>Hamlet once said</p>\n<div class=\"codehilite\"><pre>def func():\n x = 1\n\n y = 2\n\n z = 3\n</pre></div>\n\n\n<p>And all was good.</p>",
|
||||
"bugdown_matches_marked": false
|
||||
"bugdown_matches_marked": true
|
||||
},
|
||||
{
|
||||
"name": "codeblock_backticks",
|
||||
"input": "\n```\nfenced code\n```\n\n```inline code```\n",
|
||||
"expected_output": "<div class=\"codehilite\"><pre>fenced code\n</pre></div>\n\n\n<p><code>inline code</code></p>",
|
||||
"bugdown_matches_marked": false
|
||||
"bugdown_matches_marked": true
|
||||
},
|
||||
{
|
||||
"name": "hanging_multi_codeblock",
|
||||
|
||||
@@ -103,7 +103,7 @@ var bugdown_data = JSON.parse(fs.readFileSync(path.join(__dirname, '../../../fix
|
||||
{input: 'hello there', expected: '<p>hello there</p>'},
|
||||
{input: 'hello **bold** for you', expected: '<p>hello <strong>bold</strong> for you</p>'},
|
||||
{input: '__hello__', expected: '<p>__hello__</p>'},
|
||||
{input: '\n```\nfenced code\n```\n\nand then after\n', expected: '<div class="codehilite"><pre>fenced code\n</pre></div><p>and then after</p>'},
|
||||
{input: '\n```\nfenced code\n```\n\nand then after\n', expected: '<div class="codehilite"><pre>fenced code\n</pre></div>\n\n\n<p>and then after</p>'},
|
||||
{input: '* a\n* list \n* here',
|
||||
expected: '<ul>\n<li>a</li>\n<li>list </li>\n<li>here</li>\n</ul>'},
|
||||
{input: 'Some text first\n* a\n* list \n* here\n\nand then after',
|
||||
@@ -111,7 +111,7 @@ var bugdown_data = JSON.parse(fs.readFileSync(path.join(__dirname, '../../../fix
|
||||
{input: '1. an\n2. ordered \n3. list',
|
||||
expected: '<p>1. an</p>\n<p>2. ordered </p>\n<p>3. list</p>'},
|
||||
{input: '\n~~~quote\nquote this for me\n~~~\nthanks\n',
|
||||
expected: '<blockquote><p>quote this for me</p></blockquote><p>thanks</p>'},
|
||||
expected: '<blockquote>\n<p>quote this for me</p>\n</blockquote>\n\n\n<p>thanks</p>'},
|
||||
{input: 'This is a @**Cordelia Lear** mention',
|
||||
expected: '<p>This is a <span class="user-mention" data-user-email="cordelia@zulip.com">@Cordelia Lear</span> mention</p>'},
|
||||
{input: 'This is an :emoji: message',
|
||||
|
||||
Reference in New Issue
Block a user