diff --git a/build.js b/build.js index bf5e415..fa54ead 100644 --- a/build.js +++ b/build.js @@ -2,6 +2,7 @@ const dedent = require("dedent"); const ejs = require("ejs"); const fs = require("fs"); +const hljs = require("highlight.js"); const mkdirp = require("mkdirp"); const postcss = require("postcss"); @@ -17,10 +18,8 @@ function example(code) { const magicBrackets = /\[\[(.*)\]\]/g; const dedented = dedent(code); const inline = dedented.replace(magicBrackets, "$1"); - const escaped = dedented - .replace(magicBrackets, "") - .replace(//g, ">"); + const escaped = hljs.highlight("html", dedented.replace(magicBrackets, "")) + .value; return `
<button>I am being pressed</button>
+ <button>I am being pressed</button>
<button disabled>I cannot be clicked</button>
+ <button disabled>I cannot be clicked</button>
<button>I am focused</button>
+ <button>I am focused</button>
<input type="checkbox" id="example1">
-<label for="example1">This is a checkbox</label>
+ <input type="checkbox" id="example1">
+<label for="example1">This is a checkbox</label>
<div class="field-row">
- <input checked type="checkbox" id="example2">
- <label for="example2">I am checked</label>
-</div>
-<div class="field-row">
- <input disabled type="checkbox" id="example3">
- <label for="example3">I am inactive</label>
-</div>
-<div class="field-row">
- <input checked disabled type="checkbox" id="example4">
- <label for="example4">I am inactive but still checked</label>
-</div>
+ <div class="field-row">
+ <input checked type="checkbox" id="example2">
+ <label for="example2">I am checked</label>
+</div>
+<div class="field-row">
+ <input disabled type="checkbox" id="example3">
+ <label for="example3">I am inactive</label>
+</div>
+<div class="field-row">
+ <input checked disabled type="checkbox" id="example4">
+ <label for="example4">I am inactive but still checked</label>
+</div>
<div class="field-row">
- <input id="radio5" type="radio" name="first-example">
- <label for="radio5">Yes</label>
-</div>
-<div class="field-row">
- <input id="radio6" type="radio" name="first-example">
- <label for="radio6">No</label>
-</div>
+ <div class="field-row">
+ <input id="radio5" type="radio" name="first-example">
+ <label for="radio5">Yes</label>
+</div>
+<div class="field-row">
+ <input id="radio6" type="radio" name="first-example">
+ <label for="radio6">No</label>
+</div>
<div class="field-row">
- <input id="radio7" type="radio" name="second-example">
- <label for="radio7">Peanut butter should be smooth</label>
-</div>
-<div class="field-row">
- <input checked disabled id="radio8" type="radio" name="second-example">
- <label for="radio8">I understand why people like crunchy peanut butter</label>
-</div>
-<div class="field-row">
- <input disabled id="radio9" type="radio" name="second-example">
- <label for="radio9">Crunchy peanut butter is good</label>
-</div>
+ <div class="field-row">
+ <input id="radio7" type="radio" name="second-example">
+ <label for="radio7">Peanut butter should be smooth</label>
+</div>
+<div class="field-row">
+ <input checked disabled id="radio8" type="radio" name="second-example">
+ <label for="radio8">I understand why people like crunchy peanut butter</label>
+</div>
+<div class="field-row">
+ <input disabled id="radio9" type="radio" name="second-example">
+ <label for="radio9">Crunchy peanut butter is good</label>
+</div>