diff --git a/.eleventy.js b/.eleventy.js index 3c41a35..cf4fdf0 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -6,6 +6,7 @@ const { EleventyPluginCodeDemo } = require('./src'); module.exports = (eleventyConfig) => { eleventyConfig.addPlugin(EleventyPluginCodeDemo, { renderDocument: ({ html, css, js }) => ` + diff --git a/README.md b/README.md index a0b34bf..d79e231 100644 --- a/README.md +++ b/README.md @@ -18,11 +18,11 @@ const { EleventyPluginCodeDemo } = require('eleventy-plugin-code-demo'); eleventyConfig.addPlugin(EleventyPluginCodeDemo, { // Use any shortcode name you want name: 'shortcodeName', - /* Render whatever document structure you want (other than doctype). The - HTML, CSS, and JS parsed from the shortcode's body are supplied to this - function as an argument, so you can position them wherever you want, or - add class names or data-attributes to html/body */ + /* Render whatever document structure you want. The HTML, CSS, and JS parsed + from the shortcode's body are supplied to this function as an argument, so + you can position them wherever you want, or add class names or data-attributes to html/body */ renderDocument: ({ html, css, js }) => ` + diff --git a/src/index.js b/src/index.js index 7d71dad..25b4e82 100644 --- a/src/index.js +++ b/src/index.js @@ -30,8 +30,7 @@ const makeCodeDemoShortcode = (options) => { const className = clsx(sharedIframeAttributes?.class, props.class); const iframeAttributes = stringifyAttributes({ ...sharedIframeAttributes, ...props, class: className }); - let srcdoc = `${options.renderDocument({ html, css, js })}`; - + let srcdoc = options.renderDocument({ html, css, js }); // Convert all the HTML/CSS/JS into one long string with zero non-essential white space, comments, etc. Also escape HTML tags. srcdoc = escape( minifyHtml.minify(Buffer.from(srcdoc), {