Skip to content
<ex-ample> Web Component for interactive HTML/JS examples
JavaScript HTML CSS
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md
ex-ample.css
ex-ample.js
index.html
package.json

README.md

<ex-ample>

Install

npm i @ondras/ex-ample --registry https://npm.pkg.github.com

Include

<link rel="stylesheet" href="node_modules/@ondras/ex-ample/ex-ample.css" />
<script src="node_modules/@ondras/ex-ample/ex-ample.js"></script>

Syntax highlighting

Uses highlight.js when present. Pick any distribution/styling that is appropriate.

<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.16.2/build/styles/github.min.css" />
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.16.2/build/highlight.min.js"></script>

Use

JavaScript code samples shall use the (global, non-standard) appendChild function for output.

<!-- HTML editor -->
<ex-ample>
    <a href="#">some <em>link</em></a>
</ex-ample>

<!-- JS editor -->
<ex-ample language="js">
    let node = document.createElement("marquee");
    node.textContent = "Hello";
    appendChild(node);
</ex-ample>

Demo page

https://ondras.github.io/ex-ample/

Awesome!

Built with love (and caribbean rum) by Ondřej Žára

You can’t perform that action at this time.