mkdocstrings-nim
Generate API documentation for your Nim projects with MkDocs or Zensical.
mkdocstrings-nim extracts documentation from Nim source files using the Nim compiler's AST, including module docstrings, procedure signatures, parameter types, return types, and pragma annotations. It renders the documentation as HTML using mkdocstrings with either MkDocs (and mkdocs-material) or Zensical (the next-generation MkDocs successor).
Full Documentation | Changelog
Quick Start
Prerequisites
- Nim compiler installed and in PATH (install Nim)
- Python 3.9+ (install Python)
Using with Zensical (Recommended)
Zensical is the high-performance successor to MkDocs by the creators of Material for MkDocs. mkdocstrings-nim supports Zensical out-of-the-box, automatically generating required CSS and media assets in site/ during build.
1. Install
pip install zensical mkdocstrings-nim
2. Configure zensical.toml
[project]
site_name = "My Nim Project"
[project.plugins.mkdocstrings]
default_handler = "nim"
[project.plugins.mkdocstrings.handlers.nim]
paths = ["src"]
3. Run
zensical serve # local dev server
zensical build # build static site
Using with MkDocs
1. Install
pip install mkdocs mkdocs-material mkdocstrings-nim
2. Configure mkdocs.yml
In your Nim project root, create mkdocs.yml:
site_name: My Nim Project
theme:
name: material
plugins:
- search
- mkdocstrings:
handlers:
nim:
paths: [src] # Where your .nim files are
options:
show_source: true
docstring_style: rst
3. Run
mkdocs serve # local dev server
mkdocs build # build static site
Documenting Your Code
Create a docs/ directory with an index.md:
mkdir docs
docs/index.md:
# My Nim Project
Welcome to my project documentation.
## API Reference
::: mymodule
The ::: mymodule directive tells mkdocstrings to extract and render documentation from src/mymodule.nim.
Open http://127.0.0.1:8000 to see your documentation.
5. Build for deployment
mkdocs build
This creates a site/ directory with static HTML ready to deploy to GitHub Pages, Netlify, or any static host.
Writing Nim Docstrings
Use ## comments to document your Nim code:
## This module provides greeting utilities.
proc greet*(name: string): string =
## Greet someone by name.
##
## :param name: The name to greet
## :returns: A greeting message
result = "Hello, " & name & "!"
type
Config* = object
## Configuration for the greeter.
prefix*: string ## The greeting prefix
suffix*: string ## The greeting suffix
Supported docstring styles: rst (default), google, numpy, epydoc.
Configuration Options
Configure in mkdocs.yml under plugins > mkdocstrings > handlers > nim > options:
| Option | Default | Description |
|---|---|---|
paths |
["src"] |
Search paths for Nim source files |
docstring_style |
"rst" |
Docstring format: rst, google, numpy, epydoc, auto |
show_source |
true |
Show source file and line numbers |
show_signature |
true |
Show full procedure signatures |
show_pragmas |
true |
Show pragma annotations like {.raises.} |
show_private |
false |
Include non-exported (private) symbols |
heading_level |
2 |
Starting heading level for entries |
source_url |
null |
Repository URL for source links (e.g., https://github.com/user/repo) |
See the full documentation for more details.
Projects Using mkdocstrings-nim
- nim-typestates - Compile-time state machine verification
- lockfreequeues - Lock-free data structures for Nim
License
MIT
Metadata
Release files for mkdocstrings-nim 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mkdocstrings_nim-0.3.0.tar.gz | 38.2 kB | With provenance | Details for mkdocstrings_nim-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mkdocstrings_nim-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for mkdocstrings_nim-0.3.0-py3-none-any.whl |
Total release size: 125.2 kB
Release files / mkdocstrings_nim-0.3.0.tar.gz
| Download URL | mkdocstrings_nim-0.3.0.tar.gz |
|---|---|
| Size | 38.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
020adb522b987ed2fced43d27d3eb20f26d92fea2d2aae573fe43036a3779dc2
|
|
BLAKE2b-256 checksum How to use checksums |
2ee495ef24ceb799b86aba8615d2fb6801bdbdf820f3fe7b2f3905d82cb4b445
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.
Transparency logRelease files / mkdocstrings_nim-0.3.0-py3-none-any.whl
| Download URL | mkdocstrings_nim-0.3.0-py3-none-any.whl |
|---|---|
| Size | 87.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a10de03f8463e49fde8c3bbf15d4eb82e003239dc06c8538863779aafc0ce6ad
|
|
BLAKE2b-256 checksum How to use checksums |
8882e9000eb45cbfc0a14823eb8dcd44f28cf03fa81a076e3ef8809af63806c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.
Transparency logSecurity for mkdocstrings-nim 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for mkdocstrings_nim-0.3.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.