An extensible static site generator.
Project description
Pyndakaas
An extensible static site generator written in Python.
Features
- Extensible Handler System: Register custom file handlers for different content types
- Flexible Renderer System: Support for multiple rendering engines (Markdown, etc.)
- Template Support: Jinja2-based templating with metadata support
- File Metadata: JSON frontmatter parsing for rich content metadata
- Glob Matching: Template functions for filtering and selecting files
Installation
pip install pyndakaas
For development:
git clone https://github.com/rubenvannieuwpoort/pyndakaas
cd pyndakaas
pip install -e .
Quick Start
from pathlib import Path
from pyndakaas import process_dir, Handler, register, renderer
# Define a custom handler
@register()
class MarkdownHandler(Handler):
suffix = '.html'
template = 'post'
renderer = 'markdown'
@staticmethod
def detect(source_path: Path) -> bool:
return source_path.suffix == '.md'
# Define a custom renderer
@renderer("markdown")
def render_markdown(source: str) -> str:
# Your markdown rendering logic here
return f"<p>{source}</p>"
# Process directory
process_dir(Path('src'), Path('output'))
File Format
Source files use JSON frontmatter followed by content:
{
"title": "My Post",
"template": "post",
"renderer": "markdown"
}
# My Content
This is the actual content that will be processed.
Handlers
Handlers define how different file types are processed:
suffix: Output file extensiontemplate: Default template to userenderer: Default renderer for contentdetect(): Method to identify files this handler should process
Templates
Templates are Jinja2 files in the templates/ directory. They receive:
- All metadata from the source file
body: Rendered contentpath: Source file pathsource: Raw source contentglob(): Function to filter files by pattern
License
MIT License - see LICENSE file for details.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyndakaas-0.0.1.tar.gz.
File metadata
- Download URL: pyndakaas-0.0.1.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0e16926977fb11e675e68a8997b9965a9b58d0e1b125ec537b2ff257e2e34d3
|
|
| MD5 |
13adec6c060a167c628daefe72444ac4
|
|
| BLAKE2b-256 |
844d0f8a99c9d622b393ae157660b5a18c47b7de5cdccc57ebb95e1aa221a360
|
File details
Details for the file pyndakaas-0.0.1-py3-none-any.whl.
File metadata
- Download URL: pyndakaas-0.0.1-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a1a61e9f817d08137e79f3de5dd373eb46fdff873f38956de52bd0dc5e037b5
|
|
| MD5 |
7318288fbeb256e3fcba8a0af5c6e892
|
|
| BLAKE2b-256 |
86127bedf29ffc87a17dd6dd27b3d8a3e9d8cee3bd3d7d1cd45ae61b9daab12f
|