commit 8b34965024e5dff7ade03e7ea93d198daaa8aceb parent 8dc5497aabb803e24ccf604689a3523b144bd484 Author: Rikard Karlsen <rk@cassettian.space> Date: Sun, 5 Sep 2021 12:56:03 +0200 feat: add printmd Diffstat:
| A | printmd | | | 17 | +++++++++++++++++ |
1 file changed, 17 insertions(+), 0 deletions(-)
diff --git a/printmd b/printmd @@ -0,0 +1,17 @@ +#!/bin/sh + +[ "$1" = "" ] && echo "no file provided" && exit +[ ! -f "$1" ] && echo "no such file: $1" && exit + +tmp_md="/tmp/printmd_$1.md" +tmp_pdf="/tmp/printmd_$1.pdf" + +cp "$1" "$tmp_md" + +echo '<style>html { font-family: "PT Serif", serif } body { max-width: 100%; padding: 0; } h3, h4, h5, h6 { margin-bottom: -0.75em; } h2 { border-bottom: 1px solid; page-break-before: always; } img { display: block; margin: auto; }</style>' >> "$tmp_md" + +pandoc -s -t html -o "$tmp_pdf" "$tmp_md" + +lpr "$tmp_pdf" +rm "$tmp_pdf" +