DEV: support multiple capture groups for text post process

This commit is contained in:
Sam
2017-07-20 15:33:36 -04:00
parent d7a20c8e93
commit 44fb2a2833
4 changed files with 39 additions and 14 deletions

View File

@ -1,5 +1,5 @@
function addMention(buffer, match, state) {
let username = match.slice(1);
function addMention(buffer, matches, state) {
let username = matches[1] || matches[2];
let mentionLookup = state.md.options.discourse.mentionLookup;
let getURL = state.md.options.discourse.getURL;
@ -39,7 +39,7 @@ export function setup(helper) {
helper.registerPlugin(md => {
const rule = {
matcher: /@\w[\w.-]{0,58}\w|@\w/,
matcher: /@(\w[\w.-]{0,58}\w)|@(\w)/,
onMatch: addMention
};