Re:The easy way to make a website with Markdown
by oneshtein on Tuesday September 02, 2025 @01:49PM
(#45106580)
I use one line static site generator:
for I in *.md; do pandoc "$I" --template=template.html --metadata title="My Site" -o "${I%.md}.html"; done
Re:The easy way to make a website with Markdown
by masfuerte on Tuesday September 02, 2025 @03:55PM
(#45108198)
pandoc is awesome. As well as standard markdown it can handle syntax highlighting, convert LaTeX equations to MathML and much else besides.
Re:The easy way to make a website with Markdown
by 0xbadcafebee on Tuesday September 02, 2025 @03:53PM
(#45108180)
Came here to post this too. Pandoc and a few lines of shell, all you need. Here is a super fancy Makefile:
CONTENT_DIR := content
BUILD_DIR := public
MD_FILES := $(shell find $(CONTENT_DIR) -name '*.md')
HTML_OUT := $(patsubst $(CONTENT_DIR)/%.md,$(BUILD_DIR)/%.html,$(MD_FILES))
.PHONY: all clean assets serve
all: $(HTML_OUT) assets
assets:
@mkdir -p $(BUILD_DIR) && cp -a static/style.css $(BUILD_DIR)/
$(BUILD_DIR)/%.html: $(CONTENT_DIR)/%.md templates/default.html site.yaml
@mkdir -p $(dir $@)
pandoc --standalone --from gfm --to html5 \
--template=templates/default.html \
--metadata-file=site.yaml \
--toc --toc-depth=3 \
-o $@ $<
Ask ChatGPT, it'll spit out the rest (sample posts, template, CSS, YAML, Makefile, etc)
I consider my own static site generator [1] much simpler than this. Around 250 SLOC with 4 dependencies (markdown2, pyyaml, jinja2, Pygments)
[1]: https://github.com/oxalorg/genox