Skip to content

Billeclipse/static-generator

Repository files navigation

Static Generator

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.

Features

  • 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

Repository Layout

static-generator/
|- build.sh
|- main.sh
|- test.sh
|- template.html
|- content/
|- static/
|- src/
|- docs/
|- lesson_docs/
`- output/pdf/

Local Development

Generate and serve the site locally:

./main.sh

Then open http://localhost:8888.

Production Build

Build the site for GitHub Pages:

./build.sh

The production build writes the generated site into docs/ and rewrites root-relative links for the repository base path.

Testing

Run the unit tests with:

./test.sh

Generation Flow

  1. Markdown files are read from content/.
  2. Static assets are copied from static/ into docs/.
  3. Markdown is split into blocks and inline elements.
  4. The parser converts content into HTML node objects.
  5. Pages are rendered through template.html.
  6. Nested directories are preserved in the generated output.

GitHub Pages

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.

Lesson Documentation

The lesson-by-lesson project log is stored in lesson_docs/lessons.json. A generated PDF summary is stored at output/pdf/lessons.pdf.

Requirements

  • Python 3
  • Standard library only for the generator itself
  • A shell environment capable of running the provided scripts

License

No license file has been added yet.

About

Python project from boot.dev courses, static site generator with Markdown parsing, HTML node rendering, recursive page generation, and GitHub Pages deployment support.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages