diff --git a/files/assets/js/markdown.js b/files/assets/js/markdown.js index de10f8943..91e886d6e 100644 --- a/files/assets/js/markdown.js +++ b/files/assets/js/markdown.js @@ -23,7 +23,31 @@ marked.use({ const u = token.raw; return ` ${u}`; } - } + }, + { + name: 'group_mention', + level: 'inline', + start: function(src){ + const match = src.match(/![a-zA-Z0-9_\-]+/); + return match != null ? match.index : -1; + }, + tokenizer: function(src) { + const rule = /^![a-zA-Z0-9_\-]+/; + const match = rule.exec(src); + if(match){ + return { + type: 'group_mention', + raw: match[0], + text: match[0].trim().slice(1), + tokens: [] + }; + } + }, + renderer(token) { + const g = token.raw; + return `!${g}`; + } + }, ] });