Notebook Markdown email rendering fix (#16417)

* fix email WYSIWYG rendering
This commit is contained in:
Vasu Bhog
2021-07-23 15:24:34 -07:00
committed by GitHub
parent 66c62fcce3
commit 151522013f
2 changed files with 25 additions and 5 deletions

View File

@@ -134,11 +134,16 @@ export class NotebookMarkdownRenderer {
} else {
// HTML Encode href
href = href.replace(/&(?!amp;)/g, '&')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#39;');
let uri = URI.parse(href);
// mailto uris do not need additional encoding of &, otherwise it would not render properly
if (uri.scheme !== 'mailto') {
href = href.replace(/&(?!amp;)/g, '&amp;');
} else {
href = href.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#39;');
}
return `<a href=${href} data-href="${href}" title="${title || href}">${text}</a>`;
}
};