A small static site generator built step by step in Python.
This project reads Markdown content, converts it into an intenal node tree, renders that tree to HTML, copies static assets, and generates a complete multi-page site ready for local preview or GitHub Pages deployment.
- Parses inline Markdown into typed text nodes
- Converts text nodes into HTML node trees
- Splits Markdown documents into block-level structures
- Detects headings, paragraphs, quotes, code blocks, unordered lists, and ordered lists
- Renders full Markdown documents into HTML
- Copies static assets into the generated site output
- Generates all pages recursively from the
content/directory - Supports a configurable base path for GitHub Pages deployments
- Includes unit tests for parser and generator behavior
static-generator/
|- build.sh
|- main.sh
|- test.sh
|- template.html
|- content/
|- static/
|- src/
|- docs/
|- lesson_docs/
`- output/pdf/
Generate and serve the site locally:
./main.shThen open http://localhost:8888.
Build the site for GitHub Pages:
./build.shThe production build writes the generated site into docs/ and rewrites root-relative links for the repository base path.
Run the unit tests with:
./test.sh- Markdown files are read from
content/. - Static assets are copied from
static/intodocs/. - Markdown is split into blocks and inline elements.
- The parser converts content into HTML node objects.
- Pages are rendered through
template.html. - Nested directories are preserved in the generated output.
This repository is designed to publish from the docs/ directory on the main branch.
The production build currently targets this repository base path:
/static-generator/
If the repository name changes, update build.sh.
The lesson-by-lesson project log is stored in lesson_docs/lessons.json.
A generated PDF summary is stored at output/pdf/lessons.pdf.
- Python 3
- Standard library only for the generator itself
- A shell environment capable of running the provided scripts
No license file has been added yet.