updated htmlLinkRegex to allow for optional attributes in anchor tags
This commit is contained in:
parent
e99989c268
commit
ceaa7f6f89
1 changed files with 2 additions and 1 deletions
3
utils.js
3
utils.js
|
|
@ -10,8 +10,9 @@ export function markdownLinkRegex(url) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function htmlLinkRegex(url) {
|
export function htmlLinkRegex(url) {
|
||||||
|
const escapedUrl = url.replaceAll('.', '\\.')
|
||||||
return new RegExp(
|
return new RegExp(
|
||||||
`(<a [^>]*href="https:\\/\\/${url.replaceAll('.', '\\.')}[^"]*"[^>]*>).*?(<\\/a>)`,
|
`(<a[^>]+href=["']https?:\\/\\/${escapedUrl}[^"']*["'][^>]*>).*?(<\\/a>)`,
|
||||||
'i',
|
'i',
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue