From d040bde2c9bb0961e67c55db4b9bf81cdc7180f3 Mon Sep 17 00:00:00 2001 From: Zygo Blaxell Date: Fri, 9 Oct 2020 01:06:32 -0400 Subject: [PATCH] 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 --- docs/Makefile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/Makefile b/docs/Makefile index aaaeea1..9b89472 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -1,9 +1,15 @@ -MARKDOWN := $(firstword $(shell command -v markdown markdown2 markdown_py 2>/dev/null || echo markdown)) +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 +%.html: %.md Makefile $(MARKDOWN) $< | sed -e 's/\.md/\.html/g' > $@.new mv -f $@.new $@