Skip to content

Instantly share code, notes, and snippets.

@gernotstarke
Created January 1, 2022 09:45
Show Gist options
  • Save gernotstarke/8deff51f87f1fe0270c88e21fe9fa74b to your computer and use it in GitHub Desktop.
Save gernotstarke/8deff51f87f1fe0270c88e21fe9fa74b 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