This project is a wrapper around Pandoc that aims to help
organize and manage yaml-templates and ease & accelerate overall use of Pandoc.
- everything native Pandoc
yaml-templates can do - include templates into other templates for modular structure and reusability
- specify Pandoc CLI options in templates
- sensible template presets for reference & quick start
- interactive template picker with tree structure
- arbitrary numbers of
.mdand bibliography files and directories are handled automatically
- only one Python dependency:
PyYAML - see issues for planned features & feel free to add requests!
- install Pandoc
- install requirements from
requirements.txt, e.g./usr/bin/env python3 -m pip install -r requirements.txt - set up
.env(cp .env.example .envand optionally modify to your liking)
Execute main with sources as positional arguments. Sources can be files or
directories; all found .md files will be treated as textual content (sorted
alphabetically in traversing order) and all bibliography files will be added as
bibliographic references.
Specify environment variables before executing markup-export or set them in your
.env file.
CMD_EDITORis the command to run to open your editor. The string{}will be replaced with the file to edit. To usevimfor example setCMD_EDITOR=vim {}CMD_QUICKLOOKis the command to run to quick-look / preview an exported file (again, given by{}). On MacOS you can use Finder's Quicklook action withCMD_QUICKLOOK=qlmanage -p {} >& /dev/null.- If
QUICKLOOK_BY_DEFAULTis set to one of1,true,t,TrueorT, an exported file will be previewed when the CLI argument-qis not given; otherwise it is the other way around. TEMPLATE_DIRspecifies the (relative) template directory used to store template files.TEMPLATE_RECENTis the name the last used template is stored as in the template directory.
-o FILENAME, --out FILENAMEto specify the output. This can be a.pdfor any other output format supported by Pandoc-t TEMPLATE, --template TEMPLATEto specify the template to use.TEMPLATEis used to identify a template (.yaml-file) in the template directory. Templates in subdirectories, e.g. inpresetsare identified by preceding their name with the subdirectory's name, e.g.presets/plainfor the given preset Plain. Note that a directory or file name's prefix is sufficient to identify it, i.e.pre/plor evenp/pwould be enough to pickpresets/plainif no other template matching this string exists.-r, --recentlets you use the last used template again.-e [SAVE_AS], --edit [SAVE_AS]lets you edit and optionally save the chosen template before using it for the export. It will open the template in your editor and, ifSAVE_ASwas given, save it with this name (subdirectories can be set with/separators) into your template directory.-i, --interactiveis an alternative to-tand-e; it will display your templates as a tree and ask you to input a template analogous to the-toption. You can edit the template by suffixing the wordnewand save the edit withnew as SAVE_ASanalogously to the-eoption.-d, --debugenables passing throughstdoutandstderrof Pandoc's subprocess which is useful for debugging your custom templates.-q, --quicklookreverses the behavior specified by the environment settingQUICKLOOK_BY_DEFAULT