aboutsummaryrefslogtreecommitdiff
path: root/_make/quarto.mk
diff options
context:
space:
mode:
Diffstat (limited to '_make/quarto.mk')
-rw-r--r--_make/quarto.mk14
1 files changed, 12 insertions, 2 deletions
diff --git a/_make/quarto.mk b/_make/quarto.mk
index a52f435..5e2fe8a 100644
--- a/_make/quarto.mk
+++ b/_make/quarto.mk
@@ -11,8 +11,11 @@
#
# Dependencies:
# * quarto <https://quarto.org/>
-# * bat <https://github.com/sharkdp/bat>, with executable named "batcat"
# * perl v5.10.1 or newer
+#
+# Suggestions:
+# * glow <https://github.com/charmbracelet/glow>
+# * bat <https://github.com/sharkdp/bat>, with executable named "batcat"
# list of relative paths to directories,
# each containing an index.qmd file.
@@ -27,6 +30,13 @@
DOCUMENT_APPENDIX_REGEX ?= Appendix\\b
DOCUMENT_BIBLIOGRAPHY_REGEX ?= Bibliography\\b
+# pick as decent a Markdown pager as locally available
+_which = $(shell command -v $1 >/dev/null 2>&1 && echo $1 $2)
+CAT ?= $(strip $(or \
+ $(call _which,glow,--pager),\
+ $(call _which,batcat,--language markdown),\
+ cat))
+
PDF_DOCUMENTS ?= $(patsubst %.qmd,_site/%.pdf,$(DOCUMENTS))
$(DOCUMENTS:%=doc-render-%): doc-render-%: _site/%.pdf
@@ -35,7 +45,7 @@ _site/%.pdf: %.qmd
$(DOCUMENTS:%=doc-screening-of-%): doc-screening-of-%: %.qmd
QUARTO_LOG_LEVEL=quiet \
- quarto render $< --to markdown --output - | batcat --file-name index.qmd --language markdown
+ quarto render $< --to markdown --output - | $(CAT)
# count all characters except horisontal rulers,
# until appendices