-
Notifications
You must be signed in to change notification settings - Fork 30
/
Makefile
40 lines (34 loc) · 1.08 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# What to compile by default?
SOURCES := docs/index.md \
docs/tufte-md/index.md
TARGETS := $(patsubst %.md,%.html,$(SOURCES))
STYLES := tufte-css/tufte.css \
pandoc.css \
pandoc-solarized.css \
tufte-extra.css
.PHONY: all
all: $(TARGETS)
# Note: you will need pandoc 2 or greater for this to work
## Generalized rule: how to build a .html file from each .md
%.html: %.md tufte.html5 $(STYLES)
pandoc \
--katex \
--section-divs \
--from markdown+tex_math_single_backslash \
--filter pandoc-sidenote \
--to html5+smart \
--template=tufte \
$(foreach style,$(STYLES),--css $(notdir $(style))) \
--output $@ \
$<
.PHONY: clean
clean:
rm $(TARGETS)
# The default tufte.css file expects all the assets to be in the same folder.
# In real life, instead of duplicating the files you'd want to put them in a
# shared "css/" folder or something, and adjust the `--css` flags to the pandoc
# command to give the correct paths to each CSS file.
.PHONY: docs
docs:
cp -r $(STYLES) tufte-css/et-book/ docs/
cp -r $(STYLES) tufte-css/et-book/ tufte-css/img/ tufte-css/latex.css docs/tufte-md/