elvish/website/tools/md-to-html
Qi Xiao 9449df56af Move source code for the website into this repo.
The website contains documentations. Merging these two repos makes them
more discoverable, and encourages updating the code and doc at the same
time.
2018-06-05 21:36:32 +01:00

22 lines
331 B
Bash
Executable File

#!/bin/sh
in=$1
out=$2
opts=
has() {
head -n1 $in | grep "$@" >/dev/null
}
has toc && {
opts="$opts --toc --template=toc-and-body"
}
has number-sections && {
opts="$opts --number-sections"
}
mydir=$(dirname "$0")
$mydir/highlighter < $1 |
$mydir/macros |
pandoc -f gfm --data-dir=$mydir/pandoc-data -o $2 $opts