npm i @ondras/ex-ample --registry https://npm.pkg.github.com
<link rel="stylesheet" href="node_modules/@ondras/ex-ample/ex-ample.css" />
<script src="node_modules/@ondras/ex-ample/ex-ample.js"></script>
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>
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>
https://ondras.github.io/ex-ample/
Built with love (and caribbean rum) by Ondřej Žára