From 10a30286b15a9cb9f4122037b1498c050193ff95 Mon Sep 17 00:00:00 2001 From: Nicholas Warzin Date: Mon, 18 Dec 2023 14:49:10 -0500 Subject: [PATCH] Include instructions for rendering README.md as a PDF. --- RENDER.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 RENDER.md diff --git a/RENDER.md b/RENDER.md new file mode 100644 index 0000000..bc947c2 --- /dev/null +++ b/RENDER.md @@ -0,0 +1,20 @@ +# Rendering markdown to PDF + +For documents I intend to distribute (such as this CV), I typically watch markdown files for changes in a couple tmux panes, rendering them to PDF. If the resulting CV is a bit staid, it makes up for it with version control on the CV's contents, and a good workflow. I haven't really automated it beyond this yet. + +## Prerequisites + +- Pandoc (https://github.com/jgm/pandoc) +- A CSS file used by Pandoc for rendering the PDF, in this case something approximating GitHub's readme style (https://github.com/sindresorhus/github-markdown-css, or some such) +- entr (https://github.com/eradman/entr), or some inotify-compatible alternative + +## Command +```bash +echo README.md | entr -s 'pandoc -f gfm -t html --metadata pagetitle="CV, Nicholas Warzin, 2023" --css github.css README.md -o cv_nicholas-warzin_2023.pdf'' +``` +### Explanation + +- `-f gfm` Assume README.md is written in GitHub-flavoured Markdown, ensuring consistent rendering as a PDF and as a repository's README.md +- `-t html` Convert to PDF using HTML as the intermediate format (versus, say, LaTeX) +- `--metadata pagetitle="..."` Give the document a readable page title +- `--css github.css` Render the document like a GitHub readme