Using the source code in a container as the background for the container.
- Install the npm package
npm install show-code --save
- Include the show-code js/css in your HTML
<head>
<!-- Head contents -->
<link rel="stylesheet" type="text/css" href="node-modules/show-code/stylesheet.css">
</head>
<body>
<!-- Body contents -->
<script type="text/javascript" src="node-modules/show-code/index.js"></script>
</body>
- The add
show-code
ID to a container
<div id='show-code'>
<span>All your content!</span>
</div>
- Bonus: Add external libraries like Prism for syntax highlighting.
<head>
<!-- Head contents -->
<link rel="stylesheet" type="text/css" href="./prism.css">
</head>
<body>
<!-- Body contents -->
<script type="text/javascript" src="./prism.js"></script>
</body>
npm install -g serve
cd show-code
serve
open http://localhost:3000/example/