More markdown compatibility fixes

* Escape " as "
* Enable GFM newlines
* Output a linebreak after <br> in the generated markup

(imported from commit c007ec422054f9fc66a810b66aac70f70a2a1952)
This commit is contained in:
Leo Franchi
2014-01-08 14:40:54 -05:00
parent c1442f386f
commit 439633fd03
2 changed files with 7 additions and 1 deletions

View File

@@ -238,6 +238,7 @@ function escape(html, encode) {
.replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#39;');
}
@@ -340,6 +341,11 @@ $(function () {
return out;
};
// Put a newline after a <br> in the generated HTML to match bugdown
r.br = function () {
return '<br>\n';
};
// Disable ordered lists
// We used GFM + tables, so replace the list start regex for that ruleset
// We remove the |[\d+]\. that matches the numbering in a numbered list

View File

@@ -513,7 +513,7 @@ inline.zulip = merge({}, inline.breaks, {
emoji: /^:([A-Za-z0-9_\-\+]+?):/,
usermention: /^(@\*\*([^\*]+)?\*\*)/m,
realm_filters: [],
text: replace(inline.text)
text: replace(inline.breaks.text)
(']|', '@:]|')
()
});