From 2a2c8af8288689dafc235f263d48c4879a5785f2 Mon Sep 17 00:00:00 2001 From: Kyle Bowman Date: Sun, 22 Sep 2024 19:54:18 -0400 Subject: [PATCH] chore: refactor to split content from framework --- Makefile | 15 ++++++--------- README.md | 19 +++++++++++++++++++ {src => _static}/acknowledgements.md | 0 {src => demo}/note1.md | 0 {src => demo}/note2.md | 0 src/public | 1 + 6 files changed, 26 insertions(+), 9 deletions(-) create mode 100644 README.md rename {src => _static}/acknowledgements.md (100%) rename {src => demo}/note1.md (100%) rename {src => demo}/note2.md (100%) create mode 120000 src/public diff --git a/Makefile b/Makefile index a657707..3a9bc71 100644 --- a/Makefile +++ b/Makefile @@ -1,27 +1,24 @@ SRC_DIR := src BUILD_DIR := build -MARKDOWN_FILES := $(wildcard $(SRC_DIR)/*.md) +MARKDOWN_FILES := $(wildcard $(SRC_DIR)/**/*.md) HTML_FILES := $(patsubst $(SRC_DIR)/%.md, $(BUILD_DIR)/%, $(MARKDOWN_FILES)) .PHONY: all clean all: $(HTML_FILES) -# Create the build directory if it doesn't exist -$(BUILD_DIR): - mkdir -p $(BUILD_DIR) - # Build HTML file from Markdown -$(BUILD_DIR)/%: $(SRC_DIR)/%.md | $(BUILD_DIR) - pandoc \ +$(BUILD_DIR)/%: $(SRC_DIR)/%.md + @mkdir -p $(dir $@) + @pandoc \ --from=markdown+wikilinks_title_before_pipe \ --to=html5 \ --standalone \ --template=_static/templates/base.html \ --output=$@ $< + @echo "Building $@ from $<" # Clean up generated HTML files clean: - rm -rf $(BUILD_DIR) - + rm -rf $(BUILD_DIR) \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..3fd9d22 --- /dev/null +++ b/README.md @@ -0,0 +1,19 @@ +# Usage + +Write markdown. Use the Makefile to build render it to HTML via pandoc. + +## Adding Content +The Makefile builds all Markdown files in `src` or one of +its subdirectories. You can add files directly to `src`. Or, +if you want to keep your content separate from the functionality, +you can use symlinks. + +From `src`, use `ln -s ../../dir src/dir` to make it appear that your +markdown files are in the directory, even if they are in a separate + +# Common Errors + +## "pandoc: build/public/note1: withFile: does not exist (No such file or directory)" + +Pandoc does not build the directory by default. Check that the build/public +directory exists. \ No newline at end of file diff --git a/src/acknowledgements.md b/_static/acknowledgements.md similarity index 100% rename from src/acknowledgements.md rename to _static/acknowledgements.md diff --git a/src/note1.md b/demo/note1.md similarity index 100% rename from src/note1.md rename to demo/note1.md diff --git a/src/note2.md b/demo/note2.md similarity index 100% rename from src/note2.md rename to demo/note2.md diff --git a/src/public b/src/public new file mode 120000 index 0000000..0276007 --- /dev/null +++ b/src/public @@ -0,0 +1 @@ +../../public/ \ No newline at end of file -- 2.39.5