From b1754f30b09d3d0066de46bc18fe5e45b10febf1 Mon Sep 17 00:00:00 2001 From: AleksandrHovhannisyan Date: Thu, 8 Dec 2022 07:42:30 -0500 Subject: [PATCH] Clean up package.json and readme --- README.md | 14 +++++++------- package.json | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 854e1a7..8d75a3f 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ > Add interactive code demos to an Eleventy site using Markdown code blocks. +This plugin was inspired by Maciej Mionskowski's idea in the following article: [Building HTML, CSS, and JS code preview using iframe's srcdoc attribute](https://mionskowski.pl/posts/iframe-code-preview/). In short, iframes allow us to define their markup using the `srcdoc` HTML attribute specifying all of the markup for the iframe as a string. This plugin allows you to define your code snippets in a familiar way—complete with syntax highlighting—and then compresses all of your code into one long `srcdoc` string that powers a lightweight iframe. + ## Getting Started Install the package: @@ -48,7 +50,7 @@ See [example usage](#example-usage) for how to use the shortcode. There's also a |Name|Type|Description| |----|----|-----------| |`name`|`string\|undefined`|Optional. The name to use for the shortcode. Defaults to `'codeDemo'` if not specified.| -|`renderDocument`|`(args: { html: string; css: string; js: string }) => string`|A render function to return custom markup for the document body of each iframe. This function will be called with the HTML, CSS, and JS parsed from your shortcode's children. Do not include a doctype declaration.| +|`renderDocument`|`(args: { html: string; css: string; js: string }) => string`|A render function to return custom markup for the document body of each iframe. This function will be called with the HTML, CSS, and JS parsed from your shortcode's children.| |`iframeAttributes`|`Record\|undefined`|Optional. Any HTML attributes you want to set globally on all code demos.| ### Shortcode Arguments @@ -61,7 +63,7 @@ See [example usage](#example-usage) for how to use the shortcode. There's also a ### Example Usage -> **Note**: All code comments and whitespace are removed, and quotes are escaped to ensure that they don't break your page's HTML. You do not need to worry about doing this yourself. The only caveat is that you should never supply persistent user-generated code to this shortcode, as doing so could expose your site to XSS. +> **Note**: All code comments and whitespace are removed, and HTML is escaped to ensure that it doesn't break the iframe. You do not need to worry about doing this yourself. The only caveat is that you should never supply persistent user-generated code to this shortcode, as doing so could expose your site to XSS. The shortcode renders as an interactive `