Skip to main content

Dart handler for mkdocstrings

Project description

mkdocstrings-dart

License

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.Class and ::: Class identifiers
  • Respects paths, exclude_files, and show_source options
  • Modern, wide, responsive styling

Installation

pip install mkdocstrings-dart
dart pub global activate dartdoc_json

Note: dartdoc_json is 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:

Screenshot of rendered Dart docs using the included example

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mkdocstrings_dart-0.1.1.tar.gz (328.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mkdocstrings_dart-0.1.1-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

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

Hashes for mkdocstrings_dart-0.1.1.tar.gz
Algorithm Hash digest
SHA256 691a0b42b32ffedc2d75b09eaa2398b4077895a46614435f41d723042cef9c92
MD5 e8752489d57e2811e18f6666ce7104fa
BLAKE2b-256 721e9ab6c3a08ca2ce6b6e84f999ff004b3cfc9d4c79e875bd570de28b091195

See more details on using hashes here.

File details

Details for the file mkdocstrings_dart-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for mkdocstrings_dart-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 75b71d40e526091bd14f64fe3ef60fa49b8c76ae5a02d43a9d0dfcac812f1e47
MD5 b19ebcaf67483c91c075319ecb3a686d
BLAKE2b-256 d7027b12649ca449889deba5e8e684874f7fb4d91060fd2a69075e1558fface1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page