From fc90780db920aeac21dabe044fa36a1202ff2afd Mon Sep 17 00:00:00 2001 From: Guillaume Grossetie Date: Tue, 15 Aug 2023 15:35:53 +0200 Subject: [PATCH] resolves #779 allow MathJax to load in strict CSP --- src/asciidoctorWebViewConverter.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/asciidoctorWebViewConverter.ts b/src/asciidoctorWebViewConverter.ts index a76ed3dd..58b7c9dd 100644 --- a/src/asciidoctorWebViewConverter.ts +++ b/src/asciidoctorWebViewConverter.ts @@ -58,19 +58,20 @@ const previewStrings = { function getCspForResource (webviewResourceProvider: WebviewResourceProvider, securityLevel: AsciidocPreviewSecurityLevel, nonce: string): string { const rule = webviewResourceProvider.cspSource const highlightjsInlineScriptHash = 'sha256-ZrDBcrmObbqhVV/Mag2fT/y08UJGejdW7UWyEsi4DXw=' + // add font-src about: as a workaround: https://github.com/mathjax/MathJax/issues/256#issuecomment-37990603 switch (securityLevel) { case AsciidocPreviewSecurityLevel.AllowInsecureContent: - return `` + return `` case AsciidocPreviewSecurityLevel.AllowInsecureLocalContent: - return `` + return `` case AsciidocPreviewSecurityLevel.AllowScriptsAndAllContent: return '' case AsciidocPreviewSecurityLevel.Strict: default: - return `` + return `` } }