Created
August 28, 2020 23:59
-
-
Save giuliano-macedo/d2ba2ee2864116ca41104c2e8a5845f4 to your computer and use it in GitHub Desktop.
pandoc + nodemon tool, need eisvogel template
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
#!/usr/bin/env python3 | |
import argparse | |
import os | |
parser=argparse.ArgumentParser() | |
parser.add_argument("input",type=str) | |
args=parser.parse_args() | |
out_pdf=os.path.splitext(os.path.split(args.input)[-1])[0] +".pdf" | |
##create empty pdf file | |
#https://stackoverflow.com/a/17280876/5133524 | |
with open(out_pdf,"w") as f: | |
f.write("%PDF-1.0\n1 0 obj<</Pages 2 0 R>>endobj 2 0 obj<</Kids[3 0 R]/Count 1>>endobj 3 0 obj<</MediaBox[0 0 3 3]>>endobj\ntrailer<</Root 1 0 R>>") | |
os.system(f"evince {out_pdf}&") | |
exec_=f"pandoc -f commonmark_x --template eisvogel --listings {args.input} -o {out_pdf}" | |
os.system(f"nodemon --exec '{exec_}' -e 'md'") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment