markdown.js: Fix inconsistent user mention on new line.

The user mention regex was checking for multiple lines,
so it broke when the user mention was on a new line.
This changes the regex AND adds a couple tests to
test inline markdown regexes.
This commit is contained in:
Joshua Pan
2017-07-17 23:38:59 -07:00
committed by Tim Abbott
parent 5488ab4225
commit ec669a0c45
2 changed files with 7 additions and 1 deletions

View File

@@ -541,7 +541,7 @@ inline.zulip = merge({}, inline.breaks, {
'\ud83d[\ude80-\udeff]|\ud83e[\udd00-\uddff]|' +
'[\u2000-\u206F]|[\u2300-\u27BF]|[\u2B00-\u2BFF]|' +
'[\u3000-\u303F]|[\u3200-\u32FF])'),
usermention: /^(@(?:\*\*([^\*]+)\*\*|(\w+)))/m, // Match multi-word string between @** ** or match any one-word
usermention: /^(@(?:\*\*([^\*]+)\*\*|(\w+)))/, // Match multi-word string between @** ** or match any one-word
stream: /^#\*\*([^\*]+)\*\*/m,
avatar: /^!avatar\(([^)]+)\)/,
gravatar: /^!gravatar\(([^)]+)\)/,