Skip to content

Latest commit

 

History

History
50 lines (43 loc) · 1.16 KB

README.md

File metadata and controls

50 lines (43 loc) · 1.16 KB

show-code

Using the source code in a container as the background for the container.

Usage

  1. Install the npm package
npm install show-code --save
  1. 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>
  1. The add show-code ID to a container
<div id='show-code'>
      <span>All your content!</span>
</div>
  1. 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>

Example:

npm install -g serve
cd show-code
serve
open http://localhost:3000/example/

Example