fix 235221: Encode and decode markdown content to escape illegal chars
parent
da1d8b9c8e
commit
ca72122751
|
@ -355,7 +355,10 @@ document.addEventListener('click', event => {
|
|||
|
||||
window.addEventListener('load', () => {
|
||||
const htmlParser = new DOMParser();
|
||||
const markDownHtml = htmlParser.parseFromString(getData('data-md-content'), 'text/html');
|
||||
const markDownHtml = htmlParser.parseFromString(
|
||||
decodeURIComponent(getData('data-md-content')),
|
||||
'text/html'
|
||||
);
|
||||
document.body.appendChild(markDownHtml.body);
|
||||
});
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ export class MdDocumentRenderer {
|
|||
data-settings="${escapeAttribute(JSON.stringify(initialData))}"
|
||||
data-strings="${escapeAttribute(JSON.stringify(previewStrings))}"
|
||||
data-state="${escapeAttribute(JSON.stringify(state || {}))}"
|
||||
data-md-content="${escapeAttribute(JSON.stringify(body.html))}">
|
||||
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)}">
|
||||
|
|
Loading…
Reference in New Issue