🚧 This is a work in progress. Expect frequent breaking changes.
A modern documentation generator for Pkl modules using Go and Templ, because Java is indeed hot ass.
The official Pkl documentation generator (Pkldoc) is implemented in Java, which has several drawbacks:
- It's Java: Need we say more? Fine, we will...
- Slow AF Startup: Nothing says "productivity" like waiting for the JVM to warm up while you contemplate your life choices.
- Memory Hunger: Java tools devour RAM like it's an all-you-can-eat buffet.
- JVM Dependency: "Let me just install and configure this entire virtual machine to generate some docs real quick" — said no one ever.
- Complex Codebase: Because apparently simple, readable code wasn't on the requirements list.
pkl-docgen addresses these issues by providing a Go-based alternative that:
- Is Blazingly Fast: Go compiles to native code, so you can generate docs before your coffee gets cold.
- Has No JVM Dependency: Run a single binary without explaining to your computer what a classpath is.
- Is Simpler to Extend: Uses straightforward Go code that won't make you question your career choices.
- Has a Smaller Footprint: Produces binaries that don't require their own zip code.
- Uses Modern Web Templates: Leverages Templ for type-safe HTML templates that don't shit the bed when you use a conditional.
- Parse and document Pkl modules, classes, properties, functions, and type aliases
- Generate clean, searchable HTML documentation
- Support for Markdown in documentation comments
- Member navigation and search
- Cross-references between modules
- Won't make your computer fans sound like a jet engine
# Clone the repository
git clone https://github.com/prnk28/pkl-docgen.git
cd pkl-docgen
# Install dependencies
make deps
# Build the binary
make build
# Optionally install the binary
make installgo install github.com/prnk28/pkl-docgen/cmd/pkl-docgen@latest# Basic usage
pkl-docgen -output-dir=./docs -static-dir=./web path/to/your/pkl/module.pkl
# Multiple modules
pkl-docgen -output-dir=./docs -static-dir=./web module1.pkl module2.pkl
# Help
pkl-docgen -help-output-dir: Directory where documentation will be generated (default: "pkldoc")-static-dir: Directory containing static assets (CSS, JS, images)-help: Show help information for when you inevitably forget the above options
# Generate templ code after changes
make generate
# Build the binary
make build
# Run with a sample module
make run MODULE_PATH=./examples/config.pkl
# Run tests
make testpkl-docgen uses the official Pkl Go bindings to parse and evaluate Pkl modules, because reinventing the wheel is overrated. It extracts documentation metadata from the modules and generates HTML documentation using the Templ framework.
- Parsing: Uses the Pkl evaluator to extract module structure and documentation
- Processing: Converts Pkl types and structures to Go data models without unnecessary complexity
- Rendering: Uses Templ templates that don't collapse when you use a conditional statement
- Static Assets: Includes CSS and JavaScript for search and navigation that won't take 5 seconds to load
We've broken down the components into small, focused pieces that do one thing well - a revolutionary concept apparently:
- Parser: Extracts documentation from Pkl modules without making your CPU cry
- Templates: Modular Templ components that render the documentation without mysterious failures
- CLI: A simple command-line interface that doesn't require a PhD to operate
- Pkl Language - The configuration language by Apple
- Templ - The templating library for Go that respects your sanity
Built because life's too short for slow documentation generators.