Dart handler for mkdocstrings
Project description
mkdocstrings-dart
A Dart handler for mkdocstrings, bringing beautiful, automatic API documentation to Dart packages in MkDocs.
Powered by dartdoc_json, it extracts doc comments, signatures, parameters, return types, and source code from your Dart libraries — no extra configuration needed.
Features
- Renders classes, constructors, methods, getters/setters
- Parameter tables with names, types, and defaults
(Parameter descriptions appear in the main method docstring) - Return type display
- Collapsible source code with Dart syntax highlighting
- Auto-detects your package name from
pubspec.yaml - Supports both
::: package.Classand::: Classidentifiers - Respects
paths,exclude_files, andshow_sourceoptions - Modern, wide, responsive styling
Installation
pip install mkdocstrings-dart
dart pub global activate dartdoc_json
Note:
dartdoc_jsonis required to parse Dart source. It's lightweight and uses the official Dart analyzer.
Usage
Note: When using mkdocstrings-dart alongside other handlers (e.g., the default Python handler), you must explicitly set the default handler if you want Dart to be used for unmarked
:::blocks, otherwise define the handler with each block definition.
In your mkdocs.yml:
plugins:
- mkdocstrings:
default_handler: dart # <- Required if you want ::: Identifier to use Dart by default
handlers:
dart:
options:
paths: ["lib"] # Default: ["lib"]
show_source: true # Show collapsible source code
exclude_files: ["curo.dart"] # Optional: skip barrel files
Options
| Option | Type | Default | Description |
|---|---|---|---|
paths |
list[str] | ["lib"] |
Directories to scan for .dart files |
show_source |
bool | true |
Show source code in a collapsible panel |
exclude_files |
list[str] | [] |
Basenames of files to skip (e.g., barrel files) |
heading_level |
int | 2 |
Starting heading level for rendered docs |
Then in your Markdown files:
# Calculator API
::: <package-name>.Calculator
# or simply
::: Calculator
Rendered Example
Below is exactly how the above ::: Calculator markdown will appear in your final HTML documentation site:
Development
# Editable install
pip install -e .
dart pub global activate dartdoc_json
mkdocs serve
Roadmap
- Support for library-level overviews
- Cross-references between classes
- Better handling of generics and annotations
- Material for MkDocs theme integration tweaks
Credits
Built with inspiration from the official mkdocstrings Python handler and powered by the excellent dartdoc_json tool.
Made with :heart: for the Dart community.
Project details
Release history Release notifications | RSS feed
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 mkdocstrings_dart-0.1.1.tar.gz.
File metadata
- Download URL: mkdocstrings_dart-0.1.1.tar.gz
- Upload date:
- Size: 328.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
691a0b42b32ffedc2d75b09eaa2398b4077895a46614435f41d723042cef9c92
|
|
| MD5 |
e8752489d57e2811e18f6666ce7104fa
|
|
| BLAKE2b-256 |
721e9ab6c3a08ca2ce6b6e84f999ff004b3cfc9d4c79e875bd570de28b091195
|
File details
Details for the file mkdocstrings_dart-0.1.1-py3-none-any.whl.
File metadata
- Download URL: mkdocstrings_dart-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75b71d40e526091bd14f64fe3ef60fa49b8c76ae5a02d43a9d0dfcac812f1e47
|
|
| MD5 |
b19ebcaf67483c91c075319ecb3a686d
|
|
| BLAKE2b-256 |
d7027b12649ca449889deba5e8e684874f7fb4d91060fd2a69075e1558fface1
|