@kkdev92/vscode-ext-kit - v4.1.1
    Preparing search index...

    Function createWebviewHtml

    • Creates a basic HTML structure for a webview.

      body is trusted HTML and csp is optional; omitting it does not create a safe policy automatically. The generated document declares lang="en". Use a localized template through setHtmlFromTemplate when another document language is required.

      Parameters

      • options: {
            body: string;
            csp?: string;
            nonce?: string;
            scripts?: string[];
            styles?: string[];
            title?: string;
        }

        HTML options

        • body: string

          Trusted HTML inserted verbatim into <body>.

        • Optionalcsp?: string

          CSP meta content, normally produced by generateCSP.

        • Optionalnonce?: string

          Applied to generated script elements.

        • Optionalscripts?: string[]

          Script URIs; attribute-escaped but not checked against the CSP.

        • Optionalstyles?: string[]

          Stylesheet URIs; attribute-escaped but not checked against the CSP.

        • Optionaltitle?: string

          Escaped document title.

      Returns string

      Complete HTML document

      const html = createWebviewHtml({
      title: 'My View',
      csp: generateCSP(webview, { nonce }),
      styles: [styleUri.toString()],
      scripts: [scriptUri.toString()],
      nonce,
      body: '<div id="root"></div>',
      });