File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -179,10 +179,10 @@ export class MarkdownParser {
179179 */
180180 static parseHashtagNumerals ( html ) {
181181 // Match #123 patterns with word boundaries
182- // (?<!\w ) ensures # is not in the middle of a word
182+ // (?<![&#\w] ) ensures # is not in the middle of a word or part of an HTML entity
183183 // (?!\w) ensures the number is followed by a non-word character or end
184184 return html . replace (
185- / (?< ! [ # \w ] ) ( # \d + ) (? ! \w ) / g,
185+ / (?< ! [ & # \w ] ) ( # \d + ) (? ! \w ) / g,
186186 '<span class="hashtag">$1</span>'
187187 ) ;
188188 }
@@ -400,9 +400,10 @@ export class MarkdownParser {
400400
401401 // Transform link sanctuary to HTML
402402 // URL should NOT be processed for markdown - use it as-is
403+ // Note: sanctuary.url is already escaped since it came from escaped HTML
403404 const anchorName = `--link-${ this . linkIndex ++ } ` ;
404405 const safeUrl = this . sanitizeUrl ( sanctuary . url ) ;
405- replacement = `<a href="${ safeUrl } " style="anchor-name: ${ anchorName } "><span class="syntax-marker">[</span><span class="link-text">${ processedLinkText } </span><span class="syntax-marker">](</span><span class="url-part">${ this . escapeHtml ( sanctuary . url ) } </span><span class="syntax-marker">)</span></a>` ;
406+ replacement = `<a href="${ safeUrl } " style="anchor-name: ${ anchorName } "><span class="syntax-marker">[</span><span class="link-text">${ processedLinkText } </span><span class="syntax-marker">](</span><span class="url-part">${ sanctuary . url } </span><span class="syntax-marker">)</span></a>` ;
406407 }
407408
408409 html = html . replace ( placeholder , replacement ) ;
You can’t perform that action at this time.
0 commit comments