@@ -325,6 +325,7 @@ export class Autolinks implements Disposable {
325325 title += `\n${ GlyphChars . Dash . repeat ( 2 ) } \nDetails timed out` ;
326326 } else {
327327 const issueTitle = escapeMarkdown ( issue . title . trim ( ) ) ;
328+ const issueTitleQuoteEscaped = issueTitle . replace ( / " / g, '\\"' ) ;
328329
329330 if ( footnotes != null ) {
330331 footnoteIndex = footnotes . size + 1 ;
@@ -340,7 +341,7 @@ export class Autolinks implements Disposable {
340341 ) ;
341342 }
342343
343- title += `\n${ GlyphChars . Dash . repeat ( 2 ) } \n${ issueTitle } \n${
344+ title += `\n${ GlyphChars . Dash . repeat ( 2 ) } \n${ issueTitleQuoteEscaped } \n${
344345 issue . closed ? 'Closed' : 'Opened'
345346 } , ${ fromNow ( issue . closedDate ?? issue . date ) } `;
346347 }
@@ -371,6 +372,7 @@ export class Autolinks implements Disposable {
371372 title += `\n${ GlyphChars . Dash . repeat ( 2 ) } \nDetails timed out` ;
372373 } else {
373374 const issueTitle = encodeHtmlWeak ( issue . title . trim ( ) ) ;
375+ const issueTitleQuoteEscaped = issueTitle . replace ( / " / g, '"' ) ;
374376
375377 if ( footnotes != null ) {
376378 footnoteIndex = footnotes . size + 1 ;
@@ -386,7 +388,7 @@ export class Autolinks implements Disposable {
386388 ) ;
387389 }
388390
389- title += `\n${ GlyphChars . Dash . repeat ( 2 ) } \n${ issueTitle } \n${
391+ title += `\n${ GlyphChars . Dash . repeat ( 2 ) } \n${ issueTitleQuoteEscaped } \n${
390392 issue . closed ? 'Closed' : 'Opened'
391393 } , ${ fromNow ( issue . closedDate ?? issue . date ) } `;
392394 }
@@ -477,3 +479,13 @@ function ensureCachedRegex(ref: CacheableAutolinkReference, outputFormat: 'html'
477479
478480 return true ;
479481}
482+
483+ function escapeQuotesInLinkTitleMarkdown ( s : string ) {
484+ // Skip the first and last quotes
485+ return s . replace ( / (? ! ^ ) " .* ?(? ! $ ) " / g, match => match . replace ( / " / g, '\\"' ) ) ;
486+ }
487+
488+ function escapeQuotesInLinkTitleHtml ( s : string ) {
489+ // Skip the first and last quotes
490+ return s . replace ( / (? ! ^ ) " .* ?(? ! $ ) " / g, match => match . replace ( / " / g, '"' ) ) ;
491+ }
0 commit comments