Skip to content

Instantly share code, notes, and snippets.

@vebutton
Created May 20, 2026 20:22
Show Gist options
  • Select an option

  • Save vebutton/f2a4106aea5502bbba5f0c5c8f1584ea to your computer and use it in GitHub Desktop.

Select an option

Save vebutton/f2a4106aea5502bbba5f0c5c8f1584ea to your computer and use it in GitHub Desktop.
md-to-printer
# Functions to format a markdown using your style sheet of choice
# requires md-to-pdf to be installed. and a style sheet
# function to create the pdf
md2pdf () {
md-to-pdf "$@" \
--stylesheet ~/obsidian-like.css \
--body-class obsidian \
--pdf-options '{"format":"Letter","margin":{"top":"0.75in","right":"0.75in","bottom":"0.75in","left":"0.75in"},"printBackground":true}'
}
# or send straight to the printer
md2print () {
md2pdf "$@" || return
for f in "$@"; do
[[ "$f" == *.md ]] && lpr "${f%.md}.pdf"
done
}
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment