2# converts markdown to latex, then uses latex to make a PDF
4[ -n "$(which pandoc)" ] || {
5 echo >&2 "You need 'pandoc' to use this program!"
8[ -n "$(which pdflatex)" ] || {
9 echo >&2 "You need 'pdflatex' to use this program!"
15 if [ -n "$prev" ]; then
21 optarg=$(expr "x$option" : 'x[^=]*=\(.*\)')
29 -o=* | --o=* | --output=* )
32 -* ) echo >&2 "$0: unknown option: $option; aborting"
39 echo >&2 "Usage: $0 [-o|--output output-file] [input-file]"
44if [ -z "$outfile" ]; then
45 if [ -n "$infile" ]; then
46 outfile=${infile%.*}.pdf
48 outfile='stdin.pdf' # input is STDIN, since no argument given
57TEMP=${TMPDIR-/tmp}/markdown2pdf.$$
58trap "status=$?; rm -rf $TEMP; exit $status" 0 INT
61iconv -t utf-8 $infile | pandoc -w latex -s > $TEMP/$BASE.tex
64 if ! pdflatex -interaction=batchmode $BASE.tex >/dev/null 2>&1; then
65 echo >&2 "LaTeX errors:"
72if [ -f $outfile ]; then
76mv --suffix=~ --backup $TEMP/$BASE.pdf $outfile
78echo -n >&2 "Created $outfile"
79[ -z "$is_target_exists" ] || {
80 echo -n >&2 " (previous file has been backed up as '$outfile~')"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list