Merge pull request #236145 from Parasaran-Python/235221
fix 235221: Sanitizing the html content by closing the unclosed tagspull/236406/head
commit
5e26b3d7c3
|
@ -353,6 +353,15 @@ document.addEventListener('click', event => {
|
|||
}
|
||||
}, true);
|
||||
|
||||
window.addEventListener('load', () => {
|
||||
const htmlParser = new DOMParser();
|
||||
const markDownHtml = htmlParser.parseFromString(
|
||||
decodeURIComponent(getData('data-md-content')),
|
||||
'text/html'
|
||||
);
|
||||
document.body.appendChild(markDownHtml.body);
|
||||
});
|
||||
|
||||
window.addEventListener('scroll', throttle(() => {
|
||||
updateScrollProgress();
|
||||
|
||||
|
|
|
@ -98,13 +98,13 @@ export class MdDocumentRenderer {
|
|||
<meta id="vscode-markdown-preview-data"
|
||||
data-settings="${escapeAttribute(JSON.stringify(initialData))}"
|
||||
data-strings="${escapeAttribute(JSON.stringify(previewStrings))}"
|
||||
data-state="${escapeAttribute(JSON.stringify(state || {}))}">
|
||||
data-state="${escapeAttribute(JSON.stringify(state || {}))}"
|
||||
data-md-content="${escapeAttribute(JSON.stringify(encodeURIComponent(body.html)))}">
|
||||
<script src="${this._extensionResourcePath(resourceProvider, 'pre.js')}" nonce="${nonce}"></script>
|
||||
${this._getStyles(resourceProvider, sourceUri, config, imageInfo)}
|
||||
<base href="${resourceProvider.asWebviewUri(markdownDocument.uri)}">
|
||||
</head>
|
||||
<body class="vscode-body ${config.scrollBeyondLastLine ? 'scrollBeyondLastLine' : ''} ${config.wordWrap ? 'wordWrap' : ''} ${config.markEditorSelection ? 'showEditorSelection' : ''}">
|
||||
${body.html}
|
||||
${this._getScripts(resourceProvider, nonce)}
|
||||
</body>
|
||||
</html>`;
|
||||
|
|
Loading…
Reference in New Issue