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
--- /dev/null
+# 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
--- /dev/null
+---
+title: acknowledgements
+author: Kyle Bowman
+---
+
+This site is heavily influenced by the following projects:
+
+| Project | Website | License |
+| ------- | ------- | ------- |
+| Sakura CSS | https://github.com/oxalorg/sakura | [MIT License](https://github.com/oxalorg/sakura/blob/master/LICENSE.txt) |
+| Normalize CSS | https://github.com/necolas/normalize.css | [MIT License](https://github.com/necolas/normalize.css/blob/master/LICENSE.md) |
+| Vim Deep Space | https://github.com/tyrannicaltoucan/vim-deep-space/ | [MIT License](https://github.com/tyrannicaltoucan/vim-deep-space/blob/master/LICENSE) |
+
+Thank you for your contributions to the open source community!
\ No newline at end of file
--- /dev/null
+---
+title: Note 1
+author: Kyle Bowman
+---
+
+This is a note that links to [[note2]].
\ No newline at end of file
--- /dev/null
+---
+title: Note 2
+author: Kyle Bowman
+---
+
+This is a note that links to [[note1]].
\ No newline at end of file
+++ /dev/null
----
-title: acknowledgements
-author: Kyle Bowman
----
-
-This site is heavily influenced by the following projects:
-
-| Project | Website | License |
-| ------- | ------- | ------- |
-| Sakura CSS | https://github.com/oxalorg/sakura | [MIT License](https://github.com/oxalorg/sakura/blob/master/LICENSE.txt) |
-| Normalize CSS | https://github.com/necolas/normalize.css | [MIT License](https://github.com/necolas/normalize.css/blob/master/LICENSE.md) |
-| Vim Deep Space | https://github.com/tyrannicaltoucan/vim-deep-space/ | [MIT License](https://github.com/tyrannicaltoucan/vim-deep-space/blob/master/LICENSE) |
-
-Thank you for your contributions to the open source community!
\ No newline at end of file
+++ /dev/null
----
-title: Note 1
-author: Kyle Bowman
----
-
-This is a note that links to [[note2]].
\ No newline at end of file
+++ /dev/null
----
-title: Note 2
-author: Kyle Bowman
----
-
-This is a note that links to [[note1]].
\ No newline at end of file
--- /dev/null
+../../public/
\ No newline at end of file