Skip to content

Instantly share code, notes, and snippets.

@themegabyte
Created January 7, 2023 18:27
Show Gist options
  • Select an option

  • Save themegabyte/27f297f5364344f12fe51158bbfa71f8 to your computer and use it in GitHub Desktop.

Select an option

Save themegabyte/27f297f5364344f12fe51158bbfa71f8 to your computer and use it in GitHub Desktop.
Convert a Joplin export to PDF using that template
#!/bin/bash
for filename in *.md; do
CREATED=$(yq '.created |= with_dtf("2006-01-02 15:04:05Z"; tz("Asia/Karachi") | format_datetime("02-Jan-06 at 3:04:05PM")) | .created' --front-matter=extract "$filename")
NEWFILENAME=$(yq '.created |= with_dtf("2006-01-02 15:04:05Z"; tz("Asia/Karachi") | format_datetime("2006-01-02 150405")) | .created' --front-matter=extract "$filename")
echo "${filename} created on: ${CREATED}"
cp "${filename}" "markdown/${NEWFILENAME}.md"
pandoc -o "pdfs/${NEWFILENAME}.pdf" -V date:"${CREATED}" --template ./eisvogel --pdf-engine=xelatex --variable mainfont=DejaVuSerif "${filename}"
done
# -V geometry:"left=1cm,right=1cm,top=1cm,bottom=1cm"
# pandoc -o result.pdf --pdf-engine=xelatex --variable mainfont=DejaVuSerif
# pandoc -o "01_12_2022\ Lecture\ 1.pdf" -V geometry:"left=1cm,right=1cm,top=0cm,bottom=0cm" --template ./eisvogel --pdf-engine=xelatex --variable mainfont=DejaVuSerif "01_12_2022\ Lecture\ 1.md"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment