Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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


pandoc is awesome. As well as standard markdown it can handle syntax highlighting, convert LaTeX equations to MathML and much else besides.


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)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: