github.com/xiaq/elvish@v0.12.0/website/md-to-html (about)

     1  #!/bin/sh
     2  in=$1
     3  out=$2
     4  opts=
     5  
     6  has() {
     7      head -n1 $in | grep "$@" >/dev/null
     8  }
     9  
    10  has toc && {
    11      opts="$opts --toc --template=toc-and-body"
    12  }
    13  has number-sections && {
    14      opts="$opts --number-sections"
    15  }
    16  
    17  mydir=$(dirname "$0")
    18  
    19  $mydir/highlighter.tool < $1 |
    20    $mydir/macros.tool |
    21    pandoc -f gfm+smart --data-dir=$mydir/pandoc-data -o $2 $opts