MDPOSTS := $(wildcard *.md **/*.md)
MDHTML := $(MDPOSTS:.md=.html)

POSTS := $(filter-out $$template.html %.rendered.html $(MDHTML),$(wildcard *.html **/*.html))
POSTS += $(MDHTML)

RENDERED := $(POSTS:.html=.rendered.html)

.PHONY: all clean

all: $(RENDERED)

clean:
	rm -f $(RENDERED) $(MDHTML)


$(MDHTML): %.html: %.md
	cmark-gfm --unsafe <'$<' >'$@'

$(RENDERED): %.rendered.html: %.html $$template.html .tools/render.sh
	.tools/render.sh '$<'