Skip to content

Instantly share code, notes, and snippets.

@webbedfeet
Forked from gernotstarke/Makefile
Created July 10, 2022 17:40
Show Gist options
  • Save webbedfeet/cf0879a5441a3e232ccd9b1d0ccdb410 to your computer and use it in GitHub Desktop.
Save webbedfeet/cf0879a5441a3e232ccd9b1d0ccdb410 to your computer and use it in GitHub Desktop.
Makefile for authoring markdown with a (BibTeX-based) citation manager like Zotero
# For a description of this file, please see:
# https://www.innoq.com/en/blog/markdown-with-zotero-workflow
#------------------------------------------------------------
# what's the name of the generated output file(s)
OUTPUT=out
# what's the name of the markdown source file
SOURCE=principles-content.md
CITATIONSTYLE=ieee.csl
BIBLIO=~/Dropbox/zotero-export/zorg-biblio.bib
TARGET=$(OUTPUT).docx $(OUTPUT).md
PANDOC=pandoc \
--from=markdown \
-s --bibliography $(BIBLIO) \
--citeproc \
--csl=$(CITATIONSTYLE) \
--metadata link-citations=true \
$(SOURCE)
# create docx
$(OUTPUT).docx: $(SOURCE) $(METADATA)
$(PANDOC) --output=$(OUTPUT).docx
# create github flavored markdown
$(OUTPUT).md: $(SOURCE) $(METADATA)
rm -rf $(OUTPUT).md
$(PANDOC) --to=gfm --output=$(OUTPUT).md
all: $(TARGET)
clean:
rm -rf $(OUTPUT).docx $(OUTPUT).md
.PHONY: all clean $(TARGET)
.DEFAULT_GOAL := all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment