Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/watermarkhu/mkdocstrings-matlab
📘 A MATLAB handler for mkdocstrings, automatic documentation from sources
https://github.com/watermarkhu/mkdocstrings-matlab
autodoc docstrings matlab mkdocs mkdocs-material mkdocs-plugin mkdocstrings python tree-sitter
Last synced: 5 days ago
JSON representation
📘 A MATLAB handler for mkdocstrings, automatic documentation from sources
- Host: GitHub
- URL: https://github.com/watermarkhu/mkdocstrings-matlab
- Owner: watermarkhu
- License: isc
- Created: 2024-09-10T09:03:49.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-01-03T12:59:58.000Z (6 days ago)
- Last Synced: 2025-01-03T13:26:03.709Z (6 days ago)
- Topics: autodoc, docstrings, matlab, mkdocs, mkdocs-material, mkdocs-plugin, mkdocstrings, python, tree-sitter
- Language: Python
- Homepage: http://watermarkhu.nl/mkdocstrings-matlab/
- Size: 1.04 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
mkdocstrings-matlab
A MATLAB handler for mkdocstrings.
[![qualify](https://github.com/watermarkhu/mkdocstrings-matlab/actions/workflows/qualify.yaml/badge.svg)](https://github.com/watermarkhu/mkdocstrings-matlab/actions/workflows/qualify.yaml)
[![documentation](https://img.shields.io/badge/docs-mkdocs-708FCC.svg?style=flat)](https://watermarkhu.nl/mkdocstrings-matlab)
[![pypi version](https://img.shields.io/pypi/v/mkdocstrings-matlab.svg)](https://pypi.org/project/mkdocstrings-matlab/)The MATLAB handler uses [Tree-sitter](https://tree-sitter.github.io/tree-sitter/) and its [MATLAB parser](https://github.com/acristoffers/tree-sitter-matlab) to collect documentation from MATLAB source code. Via the python bindings the Abstract Syntax Tree (AST) of the source code is traversed to extract useful information. The imported objected are imported as custom [Griffe](https://mkdocstrings.github.io/griffe/) objects and mocked for the [python handler](https://mkdocstrings.github.io/python/).
You can install this handler by specifying it as a dependency:
```toml title="pyproject.toml"
# PEP 621 dependencies declaration
# adapt to your dependencies manager
[project]
dependencies = [
"mkdocstrings-matlab>=0.X.Y",
]
```## Features
- **Data collection from source code**: collection of the object-tree and the docstrings is done thanks to
[Tree-sitter](https://tree-sitter.github.io/tree-sitter/).- **Support for argument validation blocks:** Tree-sitter collects your [function and method argument validation](https://mathworks.com/help/matlab/matlab_prog/function-argument-validation-1.html)
blocks to display input and output argument types and default values.
It is even able to automatically add cross-references o other objects from your API.- **Recursive documentation of MATLAB [namespaces](https://mathworks.com/help/matlab/matlab_oop/namespaces.html):**
just add `+` to the identifer, and you get the full namespace docs. You don't need to inject documentation for each class, function, and script. Additionaly, the parent namespace documentation will be either extracted from the `Contents.m` or the `readme.md` file at the root of the namespace.- **Support for documented properties:** properties definitions followed by a docstring will be recognized in classes.
- **Multiple docstring-styles support:** common support for Google-style, Numpydoc-style,
and Sphinx-style docstrings. See [Griffe's documentation](https://mkdocstrings.github.io/griffe/docstrings/) on docstrings support.- **Admonition support in Google docstrings:** blocks like `Note:` or `Warning:` will be transformed
to their [admonition](https://squidfunk.github.io/mkdocs-material/reference/admonitions/) equivalent.
*We do not support nested admonitions in docstrings!*- **Every object has a TOC entry:** we render a heading for each object, meaning *MkDocs* picks them into the Table
of Contents, which is nicely displayed by the Material theme. Thanks to *mkdocstrings* cross-reference ability,
you can reference other objects within your docstrings, with the classic Markdown syntax:
`[this object][namespace.subnamespace.object]` or directly with `[namespace.subnamespace.object][]`- **Source code display:** *mkdocstrings* can add a collapsible div containing the highlighted source code of the MATLAB object.