1
0
mirror of https://github.com/Zygo/bees.git synced 2025-05-17 13:25:45 +02:00
bees/docs/Makefile
Zygo Blaxell d040bde2c9 docs: use Github Flavored Markdown with table extension
Prefer to use cmark-gfm with extension 'table' so we can use tables in
locally-generated HTML files.  If cmark-gfm is not installed then
fall back to some other Markdown implemeentation, but the tables will
be broken on every other implementation I have tried so far.

Also make the HTML output depend on the Makefile, since there may be
document translation options specified there (like '-e table' or an
entirely different Markdown implementation).

Signed-off-by: Zygo Blaxell <bees@furryterror.org>
2020-10-09 12:24:14 -04:00

19 lines
547 B
Makefile

MARKDOWN := $(firstword $(shell command -v cmark-gfm redcarpet markdown2 markdown markdown_py 2>/dev/null || echo markdown))
# If you have cmark-gfm, you get Github-style tables; otherwise, you don't.
ifeq ($(notdir $(MARKDOWN)),cmark-gfm)
MARKDOWN += -e table
endif
.PHONY: docs
docs: $(subst .md,.html,$(wildcard *.md)) index.html ../README.html
%.html: %.md Makefile
$(MARKDOWN) $< | sed -e 's/\.md/\.html/g' > $@.new
mv -f $@.new $@
index.md: ../README.md
sed -e 's:docs/::g' < ../README.md > index.md.new
mv -f index.md.new index.md