Created
May 20, 2026 20:22
-
-
Save vebutton/f2a4106aea5502bbba5f0c5c8f1584ea to your computer and use it in GitHub Desktop.
md-to-printer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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