@@ -181,6 +181,14 @@ export class WebviewProvider implements vscode.WebviewViewProvider {
181181 "codicon.css" ,
182182 ] )
183183
184+ const katexCssUri = getUri ( webview , this . context . extensionUri , [
185+ "webview-ui" ,
186+ "node_modules" ,
187+ "katex" ,
188+ "dist" ,
189+ "katex.min.css" ,
190+ ] )
191+
184192 // const scriptUri = webview.asWebviewUri(vscode.Uri.joinPath(this._extensionUri, "assets", "main.js"))
185193
186194 // const styleResetUri = webview.asWebviewUri(vscode.Uri.joinPath(this._extensionUri, "assets", "reset.css"))
@@ -204,24 +212,25 @@ export class WebviewProvider implements vscode.WebviewViewProvider {
204212
205213 // Tip: Install the es6-string-html VS Code extension to enable code highlighting below
206214 return /*html*/ `
207- <!DOCTYPE html>
208- <html lang="en">
209- <head>
210- <meta charset="utf-8">
211- <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
212- <meta name="theme-color" content="#000000">
213- <link rel="stylesheet" type="text/css" href="${ stylesUri } ">
214- <link href="${ codiconsUri } " rel="stylesheet" />
215- <meta http-equiv="Content-Security-Policy" content="default-src 'none'; connect-src https://*.posthog.com https://*.firebaseauth.com https://*.firebaseio.com https://*.googleapis.com https://*.firebase.com; font-src ${ webview . cspSource } ; style-src ${ webview . cspSource } 'unsafe-inline'; img-src ${ webview . cspSource } https: data:; script-src 'nonce-${ nonce } ' 'unsafe-eval';">
216- <title>Cline</title>
217- </head>
218- <body>
219- <noscript>You need to enable JavaScript to run this app.</noscript>
220- <div id="root"></div>
221- <script type="module" nonce="${ nonce } " src="${ scriptUri } "></script>
222- </body>
223- </html>
224- `
215+ <!DOCTYPE html>
216+ <html lang="en">
217+ <head>
218+ <meta charset="utf-8">
219+ <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
220+ <meta name="theme-color" content="#000000">
221+ <link rel="stylesheet" type="text/css" href="${ stylesUri } ">
222+ <link href="${ codiconsUri } " rel="stylesheet" />
223+ <link href="${ katexCssUri } " rel="stylesheet" />
224+ <meta http-equiv="Content-Security-Policy" content="default-src 'none'; connect-src https://*.posthog.com https://*.firebaseauth.com https://*.firebaseio.com https://*.googleapis.com https://*.firebase.com; font-src ${ webview . cspSource } data:; style-src ${ webview . cspSource } 'unsafe-inline'; img-src ${ webview . cspSource } https: data:; script-src 'nonce-${ nonce } ' 'unsafe-eval';">
225+ <title>Cline</title>
226+ </head>
227+ <body>
228+ <noscript>You need to enable JavaScript to run this app.</noscript>
229+ <div id="root"></div>
230+ <script type="module" nonce="${ nonce } " src="${ scriptUri } "></script>
231+ </body>
232+ </html>
233+ `
225234 }
226235
227236 /**
@@ -256,6 +265,15 @@ export class WebviewProvider implements vscode.WebviewViewProvider {
256265 "codicon.css" ,
257266 ] )
258267
268+ // Get KaTeX resources
269+ const katexCssUri = getUri ( webview , this . context . extensionUri , [
270+ "webview-ui" ,
271+ "node_modules" ,
272+ "katex" ,
273+ "dist" ,
274+ "katex.min.css" ,
275+ ] )
276+
259277 const scriptEntrypoint = "src/main.tsx"
260278 const scriptUri = `http://${ localServerUrl } /${ scriptEntrypoint } `
261279
@@ -271,7 +289,7 @@ export class WebviewProvider implements vscode.WebviewViewProvider {
271289
272290 const csp = [
273291 "default-src 'none'" ,
274- `font-src ${ webview . cspSource } ` ,
292+ `font-src ${ webview . cspSource } data: ` ,
275293 `style-src ${ webview . cspSource } 'unsafe-inline' https://* http://${ localServerUrl } http://0.0.0.0:${ localPort } ` ,
276294 `img-src ${ webview . cspSource } https: data:` ,
277295 `script-src 'unsafe-eval' https://* http://${ localServerUrl } http://0.0.0.0:${ localPort } 'nonce-${ nonce } '` ,
@@ -287,6 +305,7 @@ export class WebviewProvider implements vscode.WebviewViewProvider {
287305 <meta http-equiv="Content-Security-Policy" content="${ csp . join ( "; " ) } ">
288306 <link rel="stylesheet" type="text/css" href="${ stylesUri } ">
289307 <link href="${ codiconsUri } " rel="stylesheet" />
308+ <link href="${ katexCssUri } " rel="stylesheet" />
290309 <title>Cline</title>
291310 </head>
292311 <body>
0 commit comments