Don't match punctuation suffix when linkifying channels

This commit is contained in:
Simon Ser 2021-06-06 16:00:37 +02:00
parent 403d7ec7f7
commit a419e660c0

View File

@ -1,11 +1,11 @@
import { anchorme, html } from "./index.js";
function linkifyChannel(text, transformChannel) {
var children = [];
// TODO: Don't match punctuation
const channelRegex = /(?:^|\s)(#[^\s]+)/gid;
let match;
// Don't match punctuation at the end of the channel name
const channelRegex = /(?:^|\s)(#[^\s]+[^\s.?!():;])/gid;
var children = [];
var match;
var last = 0;
while ((match = channelRegex.exec(text)) !== null) {
var channel = match[1];