1.1.1 • Published 8 years ago

highlight-bash-syntax v1.1.1

Weekly downloads
2
License
BSD
Repository
github
Last release
8 years ago

highlight-bash-syntax

highlight bash syntax with html

example

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">&gt;</span> <span class="word">cool.txt</span></span></span>
<span class="simple-command"><span class="word">echo</span> <span class="word">'ok &lt;3'</span></span></span>

api

var highlight = require('highlight-bash-syntax')

var html = highlight(src)

Return a string of html from a string of bash src.

install

npm install highlight-bash-syntax

license

BSD

1.1.1

8 years ago

1.1.0

8 years ago

1.0.0

8 years ago