Skip to content

Commit 0fd2fb4

Browse files
committed
Add make commands to generate equations
1 parent cf96efd commit 0fd2fb4

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed

tools/make/lib/docs/Makefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# DEPENDENCIES #
33

44
include $(TOOLS_MAKE_LIB_DIR)/docs/src.mk
5-
5+
include $(TOOLS_MAKE_LIB_DIR)/docs/eqns.mk
66

77
# TARGETS #
88

@@ -22,3 +22,12 @@ docs: src-docs
2222
clean-docs: clean-src-docs
2323

2424
.PHONY: clean-docs
25+
26+
27+
# Generate equations.
28+
#
29+
# This target inserts DIVs and generates SVG files for all equations in Markdown file.
30+
31+
equations: generate-equations
32+
33+
.PHONY: equations

tools/make/lib/docs/eqns.mk

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# VARIABLES #
2+
3+
REMARK_RUNNER ?= $(BIN_DIR)/remark
4+
5+
# Define the path to the remark ignore file:
6+
REMARK_IGNORE ?= $(CONFIG_DIR)/.remarkignore
7+
8+
# Define plugins:
9+
10+
PLUGIN_FOLDER ?= $(TOOLS_DIR)/remark/plugins
11+
REMARK_HTML_EQUATIONS_PLUGIN ?= $(PLUGIN_FOLDER)/remark-html-equations
12+
REMARK_SVG_EQUATIONS_PLUGIN ?= $(PLUGIN_FOLDER)/remark-svg-equations
13+
14+
# Define Markdown extensions:
15+
REMARK_EXT ?= md
16+
17+
# Define the command-line options when invoking the remark executable:
18+
GENERATE_EQUATIONS_FLAGS ?= \
19+
--ext $(REMARK_EXT) \
20+
--ignore-path $(REMARK_IGNORE) \
21+
--use $(REMARK_HTML_EQUATIONS_PLUGIN) \
22+
--use $(REMARK_SVG_EQUATIONS_PLUGIN)
23+
24+
# Define output option:
25+
OUTPUT ?= --output
26+
27+
# TARGETS #
28+
29+
# Generate equations.
30+
#
31+
# This target generates SVG files for all equations in Markdown file.
32+
33+
generate-equations: $(NODE_MODULES)
34+
$(REMARK_RUNNER) $(GENERATE_EQUATIONS_FLAGS) $(MARKDOWN_FILES) $(OUTPUT)
35+
36+
.PHONY: generate-equations

0 commit comments

Comments
 (0)