A minimal, fast static site generator focused on technical blogs and documentation. Not-An-SSG converts Markdown to beautifully styled HTML with excellent syntax highlighting, automatic image optimization, and cloud storage integration.
This evolved out of a basic SSG I wrote to power my own website. It was not initially built to be distributed as a Python package. So this is a re-write of the original SSG with more features and a more robust CLI interface. This is my first Python package, so distributions are not guaranteed to work. Use at your own risk.
- Fast & Lightweight: Decently performant, yet to benchmark. But don't use this if you want the fastest SSG
- Beautiful Themes: Modern dark theme optimized for technical content, try
not_an_ssg themes list
- Rich Markdown Support: Tables, code blocks, math expressions and more
- Image Handling: Smart optimizations, CDN integration and cloud uploads
- CLI + Imports: CLI tools, Python API, and extensive customization options
- Responsive Design: Works on mobile devices (yet to extensively test, but typography should be better)
- Server mode: Run HTML site in a server with file-watch and auto-rebuilds
- Code Highlighting: 100+ syntax highlighting themes powered by Pygments
pip install not_an_ssg
- Create your first blog post:
echo "# Hello World\nThis is my first blog post!" > my-post.md
- Set up the project (REQUIRED):
not_an_ssg config setup
This step is essential - it creates the necessary configuration files and directory structure that Not-An-SSG needs to function properly.
- Render and serve:
not_an_ssg run my-post.md
Your blog will be available at
http://localhost:6969
with automatic browser opening. Port 6969 and auto browswer open is default behavior, both can be changed with flags.
- Learn more:
not_an_ssg -h
not_an_ssg render input.md [options]
Options:
-o, --output FILE
: Output HTML file (default: generated.html)-c, --css FILE
: Custom CSS file path-r, --root URL
: Root URL for home button (default: https://google.com)--no-images
: Skip image processing and uploading-v, --verbose
: Enable verbose output
Examples:
# Basic rendering
not_an_ssg render blog-post.md
# Custom output file and CSS
not_an_ssg render blog-post.md -o index.html -c custom.css
# Skip image processing
not_an_ssg render blog-post.md --no-images
# Verbose output for debugging
not_an_ssg render blog-post.md -v
not_an_ssg serve [options]
Options:
-p, --port PORT
: Server port (default: 6969)-f, --file FILE
: HTML file to serve (default: /generated.html)--no-browser
: Don't automatically open browser
Examples:
# Start server on default port
not_an_ssg serve
# Custom port and file
not_an_ssg serve -p 8080 -f /my-blog.html
# Server without opening browser
not_an_ssg serve --no-browser
# Verbose output for debugging
not_an_ssg serve -v
not_an_ssg run input.md [options]
Options:
- All
render
options & - All
serve
options & --watch
: Watch for file changes and auto-rebuild--watch-interval SECONDS
: Watch interval (default: 1.0)
Examples:
# Render and serve with live reload
not_an_ssg run blog-post.md --watch
# Custom port with file watching
not_an_ssg run blog-post.md -p 8080 --watch
# Verbose mode for debugging
not_an_ssg run blog-post.md -v --watch
not_an_ssg themes list
not_an_ssg themes set THEME_NAME [options]
Options:
-s, --stylesheet FILE
: CSS file to modify
By default sets theme (override theme part only) to the default
articles_css.css
file in the script directory.
Examples:
# Set monokai theme
not_an_ssg themes set monokai
# Set theme for specific stylesheet
not_an_ssg themes set dracula -s custom.css
# Verbose output for debugging
not_an_ssg themes set monokai -v
not_an_ssg themes generate THEME_NAME [options]
Options:
-o, --output FILE
: Output CSS file (prints to stdout if not specified)
Examples:
# Generate and print theme CSS
not_an_ssg themes generate github-dark
# Save theme to file
not_an_ssg themes generate monokai -o monokai-theme.css
# Verbose output for debugging
not_an_ssg themes generate monokai -v
not_an_ssg themes remove [options]
not_an_ssg config show
# Verbose output for debugging
not_an_ssg config show
not_an_ssg config setup
# Verbose output for debugging
not_an_ssg config setup
not_an_ssg images list [options]
# List all images in project
not_an_ssg images list
# List images in specific path with verbose output
not_an_ssg images list -p ./v_secret_folder
Options:
-p, --path PATH
: Search path (default: current directory)-v, --verbose
: Enable verbose output
not_an_ssg images clean [options]
# Clean image names in current directory
not_an_ssg images clean
# Clean specific path with verbose output
not_an_ssg images clean -p ./assets -v
Options:
-p, --path PATH
: Path to clean (default: current directory)-v, --verbose
: Enable verbose output
# Upload all images to configured bucket
not_an_ssg images upload
# Upload with verbose output
not_an_ssg images upload -v
Options:
-v, --verbose
: Enable verbose output (highly reccomend using this)
-v, --verbose
: Enable verbose output (available on all commands)-h, --help
: Show help message for any command
your-blog/
├── templates/
│ └── assets/
│ └── img/ # Images (auto-uploaded to CDN during render, unless specified otherwise)
├── .env # Environment configuration (auto genned by config setup - this is for storage buckets)
├── config.json # Project configuration (right now only for default image dimensions)
├── articles_css.css # Main stylesheet (has all the styling and the theme - themes are swappable and auto-generated)
├── your-post.md # Your markdown files (can be renamed)
└── generated.html # Generated output (can be renamed)
Important: Before using Not-An-SSG, you must run the setup wizard. This setup is also directory dependent, so if you want to use Not-An-SSG in a different directory, you'll need to run the setup wizard again. It's not ideal, I know. Will fix this later.
not_an_ssg config setup
This interactive setup process will:
- Create the necessary configuration files (
config.json
,.env
) - Set up the required directory structure (
templates/assets/img/
) - Configure cloud storage settings if desired
- Generate the base CSS file
The setup wizard will create and configure your .env
file for cloud storage and CDN integration. You don't need to manually edit this file unless you want to change settings later.
Example configuration (automatically generated by setup):
# Cloudflare R2 / AWS S3 Configuration
STORAGE_BUCKET_NAME=your-bucket-name
STORAGE_ACCESS_KEY_ID=your-access-key
STORAGE_SECRET_ACCESS_KEY=your-secret-key
STORAGE_ENDPOINT_URL=https://your-endpoint.com
STORAGE_REGION_NAME=auto
STORAGE_ACCOUNT_ID=your-account-id
CDN_URL=https://your-cdn.com
Note: I use Cloudflare R2 for my bucket, but in theory any S3 compatible storage should work. I am however yet to test this out with S3.
The setup wizard also creates this file with default settings:
{
"image_dimensions": {
"width": 800,
"height": 500
}
}
You can modify these values manually if needed, or re-run not_an_ssg config setup
to change them interactively.
from not_an_ssg import render, serve
# Read markdown content
with open('blog-post.md', 'r') as f:
markdown_content = f.read()
# Render to HTML
html_output = render(
markdown_content,
root_location="https://yourblog.com",
input_file_path="blog-post.md"
)
# Save output
with open('output.html', 'w') as f:
f.write(html_output)
# Start development server
serve('/output.html', port=8080)
from not_an_ssg import (
render,
generate_theme_css,
set_theme,
get_images_all,
image_name_cleanup
)
# Custom CSS with theme
custom_css = generate_theme_css('github-dark')
set_theme(custom_css, 'github-dark')
# Render with custom options
html = render(
markdown_content,
root_location="https://yourblog.com",
css=custom_css,
input_file_path="blog-post.md",
verbose=True
)
# Image management
images = get_images_all('/path/to/project')
image_name_cleanup('/path/to/project')
```python
def hello_world():
print("Hello, World!")
```
You can use almost any language - powered by Pygments
| Feature | Status |
|---------|--------|
| Cool | Yes |
| Pretty | Yes |
| Simple | Yes |
| Paid | No |

<!-- With custom dimensions -->
{width="400" height="300"}
Inline math: $E = mc^2$
Block math:
$$
\frac{d}{dx} \int_a^x f(t)dt = f(x)
$$
# Automatically rebuild on file changes
not_an_ssg run blog.md --watch --watch-interval 0.5
# Use your own stylesheet
not_an_ssg run blog.md -c custom.css
You are expected to place all you images under templates/assets/img/
. Then, the following features become available:
- Cleaned filename (removes whitespaces and weird characters)
- Uploaded to your configured cloud storage
- Replaced img src with CDN URLs in the final HTML
# See detailed processing information
not_an_ssg run blog.md -v
- Images not displaying: Ensure images are in
templates/assets/img/
directory and you've runnot_an_ssg config setup
- CDN not working: Run
not_an_ssg config setup
to configure cloud storage settings - Themes not applying: Run
not_an_ssg themes set THEME_NAME
- Port already in use: Use
-p
to specify a different port. Only applicable while usingserve
- Missing files error: Always run
not_an_ssg config setup
before using other commands, although it should automatically prompt you if it does not find the required files.
# General help
not_an_ssg -h
# Command-specific help
not_an_ssg render -h
not_an_ssg run -h
- Python 3.8+
- Dependencies:
markdown
,pygments
,boto3
,python-dotenv
MIT License - see LICENSE file for details.
Contributions welcome! This project was built for personal use but has evolved to make it public. You can find the repo here.
- Initial release
- Core markdown rendering
- CLI interface
- Theme support
- Cloud storage integration
- Live development server
- Supports syntax highlighting
- Support a batch rendering mode
- Introduce file hashing to prevent unnecessary re-renders, reducing build time