This project provides a Python-based solution for converting Markdown files into HTML pages. It includes functionality to recursively process directories containing Markdown files, apply HTML templates, and serve the generated content over a simple HTTP server.
- Markdown Parsing: Converts Markdown syntax into HTML elements.
- Template Application: Integrates generated HTML content into predefined HTML templates.
- Recursive Directory Handling: Processes entire directories of Markdown files.
- Static File Management: Copies static assets to the output directory.
- Local HTTP Server: Serves the generated HTML files over a local server for preview.
src/
: Contains all Python source files.main.py
: Entry point that orchestrates the file generation and server launch.gencontent.py
: Handles the conversion of Markdown to HTML and directory processing.markdown_blocks.py
: Parses Markdown blocks into HTML nodes.inline_markdown.py
: Handles inline Markdown formatting.htmlnode.py
: Defines HTML node classes for building HTML documents.copystatic.py
: Manages copying of static files.
template.html
: HTML template used for generating pages.server.py
: Simple HTTP server for serving generated content.public/
: Default output directory for generated HTML files and static content.
- Prepare Markdown Files: Place your Markdown files in the
./content
directory. - Run the Main Script: Execute the main script to generate HTML files and copy static content.
python src/main.py
- Start the Server: Serve the generated content locally.
python server.py --dir public
- Python 3.6 or higher
- No external Python packages are required.
- Testing: Unit tests are provided for various modules.
- Run tests using:
python -m unittest discover
Contributions to this project are welcome. Please ensure that any pull requests maintain the existing coding style and include appropriate tests.
This project is licensed under the MIT License. See the LICENSE
file for more details.