@@ -172,6 +172,21 @@ export class MarkdownParser {
172172 return html ;
173173 }
174174
175+ /**
176+ * Parse GitHub-style issue/PR references
177+ * @param {string } html - HTML with potential GitHub references
178+ * @returns {string } HTML with styled GitHub references
179+ */
180+ static parseHashtagNumerals ( html ) {
181+ // Match #123 patterns with word boundaries
182+ // (?<![&#\w]) ensures # is not in the middle of a word or part of an HTML entity
183+ // (?!\w) ensures the number is followed by a non-word character or end
184+ return html . replace (
185+ / (?< ! [ & # \w ] ) ( # \d + ) (? ! \w ) / g,
186+ '<span class="hashtag">$1</span>'
187+ ) ;
188+ }
189+
175190 /**
176191 * Parse strikethrough text
177192 * Supports both single (~) and double (~~) tildes, but rejects 3+ tildes
@@ -385,9 +400,10 @@ export class MarkdownParser {
385400
386401 // Transform link sanctuary to HTML
387402 // URL should NOT be processed for markdown - use it as-is
403+ // Note: sanctuary.url is already escaped since it came from escaped HTML
388404 const anchorName = `--link-${ this . linkIndex ++ } ` ;
389405 const safeUrl = this . sanitizeUrl ( sanctuary . url ) ;
390- 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>` ;
391407 }
392408
393409 html = html . replace ( placeholder , replacement ) ;
@@ -411,6 +427,7 @@ export class MarkdownParser {
411427 html = this . parseStrikethrough ( html ) ;
412428 html = this . parseBold ( html ) ;
413429 html = this . parseItalic ( html ) ;
430+ html = this . parseHashtagNumerals ( html ) ;
414431
415432 // Step 3: Restore and transform sanctuaries
416433 html = this . restoreAndTransformSanctuaries ( html , sanctuaries ) ;
0 commit comments