Quick start
This walks through a new site from nothing to built HTML. You need the merodi binary first, see Install.
1. Create a project
merodi init -C my-site
cd my-site
new works the same as init. The folder is given with -C, and Merodi creates it if it does not exist. Without -C the current folder is used. A bare name such as merodi init my-site is not read as a folder.
This creates:
my-site/
config.toml
src/
md/index.md
templates/layout.html
plugins/main.lua
init refuses to run if config.toml already exists.
The generated index.md and layout.html are only a starting point. The build never uses layout.html unless a page includes or extends it, so the next steps replace them with something simpler.
2. Write a page
Replace src/md/index.md with:
{% document title="My site" %}
# Hello
This is my first page.
3. Build it
merodi build
Merodi writes build/draft/index.html. Open it in a browser, or serve the folder with any static file server:
python3 -m http.server -d build/draft 8000
Merodi has no built-in web server.
4. Share a header
Put the repeated parts of a page in the templates folder. Create src/templates/head.md:
{% document title=page_title %}
{% style "static/style.css" %}
Use it from a page:
{% set page_title = "About" %}
{% include "head.md" %}
# About
Some text.
Save that as src/md/about.md. Variables set before the include are visible inside the included file.
5. Add a stylesheet
Files in src/md that are not Markdown are copied to the same place in the output. Create src/md/static/style.css:
body { max-width: 40rem; margin: 2rem auto; font-family: sans-serif; }
After merodi build it is at build/draft/static/style.css.
6. Turn on Markdown extras
Tables, strikethrough and heading ids are off by default. Turn them on in src/plugins/main.lua:
merodi.enable.GFM()
merodi.enable.AutoHeadingID()
7. Release build
merodi build --release
The same pages are written to build/release/ instead. Remove build output with merodi clean (draft) or merodi clean --release.
Merodi does not delete old files on its own. If you rename or remove a page, run merodi clean and build again.