Last active
March 29, 2021 21:24
-
-
Save Und3rf10w/bb09bc108d8c41e8415855cb2ca80b68 to your computer and use it in GitHub Desktop.
Pandoc markdown export for https://obsidian.md/
This file contains 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
% change background color for inline code in | |
% markdown files. The following code does not work well for | |
% long text as the text will exceed the page boundary | |
% Taken from: https://jdhao.github.io/2019/05/30/markdown2pdf_pandoc/ | |
\definecolor{bgcolor}{HTML}{E0E0E0} | |
\let\oldtexttt\texttt | |
\renewcommand{\texttt}[1]{ | |
\colorbox{bgcolor}{\oldtexttt{#1}} | |
} |
This file contains 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
# Point this to your attachments directory. This only works for those using a single attachment directory. | |
ATTACHMENTS_DIR=~/Notes/Obsidian/attachments | |
if [[ ! $# -eq 2 ]] | |
then | |
echo "Usage: $0 </path/to/obsidian/md/note> </path/to/save/pdf>" | |
exit 0 | |
fi | |
cd $ATTACHMENTS_DIR | |
pandoc --highlight-style tango -f gfm+smart -V linkcolor:cyan --pdf-engine=xelatex -H ~/pandoc_support/head.tex -t pdf "$1" -o "$2" | |
cd - > /dev/null |
Now obsidian has a built-in print to PDF feature that works much better than this solution, I'd recommend using that over this. That or figuring out how to call the print function in the obsidian API and looping over that. Otherwise, I'd just make a bash wrapper that iterated over every file in the vault.
Yes, I saw that.
Actually, the issue is exporting all the PDFs in the sequence of the files. Now, let's say we've folders and notes in them and everything is nested. What will we do in that case?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Way to export a whole vault as an pdf?