highlight bash syntax with html
given a shell script:
#!/bin/bash
echo hello > cool.txt
echo 'ok <3'and a program to turn it into html:
var highlight = require('highlight-bash-syntax')
var fs = require('fs')
var src = fs.readFileSync('whatever.sh')
console.log(highlight(src))output:
#!/bin/bash
<span class="complete-command"><span class="simple-command"><span class="word">echo</span> <span class="word">hello</span> <span class="io-redirect"><span class="op">></span> <span class="word">cool.txt</span></span></span>
<span class="simple-command"><span class="word">echo</span> <span class="word">'ok <3'</span></span></span>var highlight = require('highlight-bash-syntax')Return a string of html from a string of bash src.
npm install highlight-bash-syntax
BSD