mkdocstrings-nim
Generate API documentation for your Nim projects.
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 MkDocs and mkdocstrings.
Full Documentation | Changelog
Quick Start
This guide gets you from zero to a running documentation server for your Nim project.
Prerequisites
- Nim compiler installed and in PATH (install Nim)
- Python 3.9+ (install Python)
1. Install the tools
pip install mkdocs mkdocs-material mkdocstrings-nim
2. Create 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. Create your docs
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.
4. Run the docs server
mkdocs serve
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.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mkdocstrings_nim-0.2.1.tar.gz | 37.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mkdocstrings_nim-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 122.6 kB
Release files / mkdocstrings_nim-0.2.1.tar.gz
| Download URL | mkdocstrings_nim-0.2.1.tar.gz |
|---|---|
| Size | 37.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
96fc860a4bfb5bcb38a084bc440f6400729dbe2321ceff61042a363816519b32
|
|
BLAKE2b-256 checksum How to use checksums |
37acc4f77bcfdaa596fc6e9a5f14e3ac757ef00678e4797136c22c50390db3a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Dec 21, 2025.
Transparency logRelease files / mkdocstrings_nim-0.2.1-py3-none-any.whl
| Download URL | mkdocstrings_nim-0.2.1-py3-none-any.whl |
|---|---|
| Size | 85.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6e72d23fc3511f7ce11ae2298280508ca65187074d256fbf90aa3fd82a65e8c5
|
|
BLAKE2b-256 checksum How to use checksums |
da79d29af479f7c23132f9760363268450dd983e963006200d0a1acee1585c44
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Dec 21, 2025.
Transparency log