Skip to main content

Zero-config static site builder for markdown blogs

Project description

mdwiki

mdwiki is a small static site builder that turns a directory tree of markdown files into a blog-ready HTML site.

It keeps the authoring model simple:

  • directories become URL segments
  • each markdown file becomes one HTML page
  • local images referenced from markdown are copied into the output site
  • index pages and tag pages are generated automatically

Install

Use uv:

uv tool install mdwiki

Or install from source:

uv sync
uv run mdwiki_exec ./example-posts ./dist

CLI

Build a site from a markdown source tree:

mdwiki_exec <source_dir> <dist_dir>

Show the built-in help or version:

mdwiki_exec --help
mdwiki_exec --version

Example:

mdwiki_exec ./post ./dist

source_dir usually contains:

  • markdown posts under dated folders such as post/2024/04/03/demo.md
  • optional local images next to each markdown file
  • optional CNAME
  • optional config.json

Optional GoatCounter support

You can enable real pageview counters by adding goatcounter_script to your config.json:

{
  "goatcounter_script": "<script data-goatcounter=\"https://drunkpig.goatcounter.com/count\" async src=\"//gc.zgo.at/count.js\"></script>"
}

When this field is present:

  • article pages render a counter next to the slug
  • index pages fetch and display per-article pageviews

When it is absent, mdwiki renders 未知 instead of fake random numbers.

GitHub Pages workflow

The recommended deployment model is:

  1. Keep markdown source in your repository.
  2. Build the site in GitHub Actions.
  3. Upload the generated dist/ directory as a Pages artifact.
  4. Deploy with actions/deploy-pages.

Example workflow:

name: Build and Deploy Pages

on:
  push:
    branches: ["master"]
  workflow_dispatch:

permissions:
  contents: read
  pages: write
  id-token: write

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: "3.11"
      - uses: actions/configure-pages@v5
      - name: Install mdwiki
        run: pip install mdwiki
      - name: Build site
        run: mdwiki_exec ./post ./dist
      - uses: actions/upload-pages-artifact@v3
        with:
          path: ./dist

  deploy:
    needs: build
    runs-on: ubuntu-latest
    environment:
      name: github-pages
    steps:
      - id: deployment
        uses: actions/deploy-pages@v4

Develop with uv

uv sync
uv run mdwiki_exec ./post ./dist
uv build

Publish to PyPI:

git tag -a v0.3.3 -m "Release v0.3.3"
git push origin master v0.3.3

Pushing a new v* tag triggers the bundled GitHub Actions release workflow, which builds the package with uv and publishes it to PyPI.

Notes

  • CNAME is optional.
  • The bundled default theme is stored under mdwiki/templates/default.
  • mdwiki_exec is the supported public CLI entrypoint.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mdwiki-0.3.4.tar.gz (35.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mdwiki-0.3.4-py3-none-any.whl (37.3 kB view details)

Uploaded Python 3

File details

Details for the file mdwiki-0.3.4.tar.gz.

File metadata

  • Download URL: mdwiki-0.3.4.tar.gz
  • Upload date:
  • Size: 35.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mdwiki-0.3.4.tar.gz
Algorithm Hash digest
SHA256 a4ce285035ed1f30be0f49e004a3b86485758448bab39536d025c66721270ae9
MD5 a7be83d70c88c01d2dcbcef7d3ae3482
BLAKE2b-256 d60341caa8b3111948bb87daee6b7dd40d54f8ba87fa521796954dea212989d3

See more details on using hashes here.

File details

Details for the file mdwiki-0.3.4-py3-none-any.whl.

File metadata

  • Download URL: mdwiki-0.3.4-py3-none-any.whl
  • Upload date:
  • Size: 37.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mdwiki-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 bb9ee89eb5ce669b5c6b0eb45ed83ada2dc59248b112284af69e89e90cbf0db8
MD5 1380d680b6cdd6363f9a23611a1c98fd
BLAKE2b-256 89f3e4f5d77edba3316d5ed64d99b9d4ff11fcd3f8325a306fbe12c89488dba7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page