mirror of
https://github.com/zulip/zulip.git
synced 2025-11-11 01:16:19 +00:00
Add a zulip module to marked, which supports emoji and user mentions
This is partially inspired by https://github.com/chjj/marked/pull/238 (imported from commit 03b84cde88fc8c2fe31c1003a5ce852cc364733e)
This commit is contained in:
@@ -259,15 +259,15 @@ $(function () {
|
||||
// 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
|
||||
marked.Lexer.rules.tables.list = /^( *)((?:\*)) [\s\S]+?(?:\n+(?=(?: *[\-*_]){3,} *(?:\n+|$))|\n{2,}(?! )(?!\1(?:\*) )\n*|\s*$)/;
|
||||
// marked.Lexer.rules.tables
|
||||
|
||||
// Disable headings
|
||||
disable_markdown_regex(marked.Lexer.rules.tables, 'heading');
|
||||
disable_markdown_regex(marked.Lexer.rules.tables, 'lheading');
|
||||
|
||||
// Disable __strong__, all <em>
|
||||
marked.InlineLexer.rules.breaks.strong = /^\*\*([\s\S]+?)\*\*(?!\*)/;
|
||||
disable_markdown_regex(marked.InlineLexer.rules.breaks, 'em');
|
||||
disable_markdown_regex(marked.InlineLexer.rules.breaks, 'del');
|
||||
marked.InlineLexer.rules.zulip.strong = /^\*\*([\s\S]+?)\*\*(?!\*)/;
|
||||
disable_markdown_regex(marked.InlineLexer.rules.zulip, 'em');
|
||||
disable_markdown_regex(marked.InlineLexer.rules.zulip, 'del');
|
||||
|
||||
marked.setOptions({
|
||||
gfm: true,
|
||||
@@ -277,6 +277,7 @@ $(function () {
|
||||
sanitize: true,
|
||||
smartLists: true,
|
||||
smartypants: false,
|
||||
zulip: true,
|
||||
renderer: r
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user