Skip to content

Commit

Permalink
Remove default doctype
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksandrHovhannisyan committed Dec 8, 2022
1 parent e9d1ae6 commit 0e398c0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
1 change: 1 addition & 0 deletions .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const { EleventyPluginCodeDemo } = require('./src');
module.exports = (eleventyConfig) => {
eleventyConfig.addPlugin(EleventyPluginCodeDemo, {
renderDocument: ({ html, css, js }) => `
<!DOCTYPE html>
<html>
<head>
<style>${css}</style>
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) => `
<!DOCTYPE html>
<html>
<head>
<style>${css}</style>
Expand Down
3 changes: 1 addition & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ const makeCodeDemoShortcode = (options) => {
const className = clsx(sharedIframeAttributes?.class, props.class);
const iframeAttributes = stringifyAttributes({ ...sharedIframeAttributes, ...props, class: className });

let srcdoc = `<!DOCTYPE html>${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), {
Expand Down

0 comments on commit 0e398c0

Please sign in to comment.