@devchitchat/chat 4.4.2 → 4.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -38,9 +38,9 @@ export function makeDateSeparator(dateKey) {
|
|
|
38
38
|
*/
|
|
39
39
|
// Combined regex (operates on raw text before HTML-escaping):
|
|
40
40
|
// group 1 (+ inner 2, 3) — markdown link: [text](url)
|
|
41
|
-
// group 4 — bare https?:// URL (excludes []() so it can't swallow
|
|
41
|
+
// group 4 — bare https?:// URL (excludes []()* so it can't swallow markdown bold/link syntax)
|
|
42
42
|
// group 5 — @mention
|
|
43
|
-
const INLINE_RE = /(\[([^\]]*)\]\((https?:\/\/[^)]+)\))|(https?:\/\/[^\s<>"'[\]()]+)|(@[a-zA-Z0-9_.-]+)/g
|
|
43
|
+
const INLINE_RE = /(\[([^\]]*)\]\((https?:\/\/[^)]+)\))|(https?:\/\/[^\s<>"'[\]()*]+)|(@[a-zA-Z0-9_.-]+)/g
|
|
44
44
|
|
|
45
45
|
export function renderText(text, { userHandle } = {}) {
|
|
46
46
|
let result = ''
|
|
@@ -54,7 +54,7 @@ export function renderText(text, { userHandle } = {}) {
|
|
|
54
54
|
// [link text](https://url)
|
|
55
55
|
result += `<a href="${escHtml(mdUrl)}" target="_blank" rel="noopener noreferrer">${escHtml(mdText)}</a>`
|
|
56
56
|
} else if (bareUrl) {
|
|
57
|
-
const trimmed = bareUrl.replace(/[.,!?;:)]+$/, '')
|
|
57
|
+
const trimmed = bareUrl.replace(/[.,!?;:)*]+$/, '')
|
|
58
58
|
const trailing = bareUrl.slice(trimmed.length)
|
|
59
59
|
result += `<a href="${escHtml(trimmed)}" target="_blank" rel="noopener noreferrer">${escHtml(trimmed)}</a>${escHtml(trailing)}`
|
|
60
60
|
} else if (mention) {
|