mkdocstrings-matlab 0.4.2__tar.gz → 0.6.0__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/.github/workflows/docs.yaml +2 -1
  2. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/.github/workflows/qualify.yaml +5 -4
  3. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/.github/workflows/release.yaml +1 -1
  4. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/CHANGELOG.md +31 -0
  5. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/PKG-INFO +12 -6
  6. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/README.md +11 -5
  7. mkdocstrings_matlab-0.6.0/docs/api.md +16 -0
  8. mkdocstrings_matlab-0.6.0/docs/img/preview_dark.png +0 -0
  9. mkdocstrings_matlab-0.6.0/docs/img/preview_light.png +0 -0
  10. mkdocstrings_matlab-0.6.0/docs/index.md +34 -0
  11. mkdocstrings_matlab-0.6.0/docs/overrides/main.html +8 -0
  12. mkdocstrings_matlab-0.6.0/docs/overrides/partials/toc-item.html +20 -0
  13. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/stylesheets/extra.css +5 -0
  14. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/usage/configuration/docstrings.md +4 -6
  15. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/usage/configuration/general.md +4 -0
  16. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/usage/configuration/headings.md +4 -0
  17. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/usage/configuration/members.md +63 -2
  18. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/usage/configuration/signatures.md +4 -0
  19. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/usage/index.md +26 -18
  20. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/mkdocs.yml +13 -17
  21. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/pyproject.toml +1 -1
  22. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/src/mkdocstrings_handlers/matlab/__init__.py +2 -1
  23. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/src/mkdocstrings_handlers/matlab/collect.py +3 -1
  24. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/src/mkdocstrings_handlers/matlab/handler.py +7 -0
  25. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/src/mkdocstrings_handlers/matlab/models.py +2 -0
  26. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/src/mkdocstrings_handlers/matlab/treesitter.py +2 -1
  27. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/uv.lock +4 -4
  28. mkdocstrings_matlab-0.4.2/docs/index.md +0 -6
  29. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/.github/CODEOWNERS +0 -0
  30. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/.gitignore +0 -0
  31. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/.python-version +0 -0
  32. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/.vscode/launch.json +0 -0
  33. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/.vscode/settings.json +0 -0
  34. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/LICENSE +0 -0
  35. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/changelog.md +0 -0
  36. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/credits.md +0 -0
  37. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/debug.py +0 -0
  38. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/license.md +0 -0
  39. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/logo.png +0 -0
  40. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/logo.svg +0 -0
  41. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/snippets/+module/+submodule/Contents.m +0 -0
  42. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/snippets/+module/+submodule/subfunction.m +0 -0
  43. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/snippets/+module/aClass.m +0 -0
  44. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/snippets/+module/do_something.m +0 -0
  45. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/snippets/+module/module.md +0 -0
  46. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/snippets/+module/readme.md +0 -0
  47. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/snippets/+mymembers/BaseClass.m +0 -0
  48. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/snippets/+mymembers/Contents.m +0 -0
  49. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/snippets/+mymembers/ThisClass.m +0 -0
  50. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/snippets/+mymembers/mymembers.md +0 -0
  51. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/snippets/+mymembers/this_function.m +0 -0
  52. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/snippets/+mynamespace/classA.m +0 -0
  53. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/snippets/+mynamespace/classB.m +0 -0
  54. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/snippets/+mynamespace/mynamespace.md +0 -0
  55. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/snippets/+mynamespace/readme.md +0 -0
  56. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/snippets/+mynamespace/typed_function.m +0 -0
  57. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/snippets/+undocumented/ClassWithoutDocstring.m +0 -0
  58. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/snippets/+undocumented/function_with_docstring.m +0 -0
  59. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/snippets/+undocumented/function_without_docstring.m +0 -0
  60. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/snippets/+undocumented/undocumented.md +0 -0
  61. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/snippets/Class.m +0 -0
  62. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/snippets/OtherClass.m +0 -0
  63. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/snippets/Thing.m +0 -0
  64. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/snippets/do_output.m +0 -0
  65. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/snippets/do_something.m +0 -0
  66. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/snippets/do_varargin.m +0 -0
  67. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/snippets/myClass.m +0 -0
  68. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/snippets/myParent.m +0 -0
  69. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/snippets/myfunction.m +0 -0
  70. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/snippets/print_hello.m +0 -0
  71. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/usage/docstrings/google.md +0 -0
  72. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/usage/docstrings/numpy.md +0 -0
  73. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/docs/usage/docstrings/sphinx.md +0 -0
  74. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/logo.svg +0 -0
  75. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/renovate.json +0 -0
  76. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/requirements.lock +0 -0
  77. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/src/mkdocs_material_matlab/__init__.py +0 -0
  78. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/src/mkdocs_material_matlab/css/style.css +0 -0
  79. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/src/mkdocs_material_matlab/mkdocs_material_matlab.py +0 -0
  80. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/src/mkdocstrings_handlers/matlab/enums.py +0 -0
  81. {mkdocstrings_matlab-0.4.2 → mkdocstrings_matlab-0.6.0}/src/mkdocstrings_handlers/matlab/py.typed +0 -0
@@ -55,7 +55,8 @@ jobs:
55
55
  env:
56
56
  PUSH_DEPLOY: ${{ fromJson(inputs.push) && '--push' || '' }}
57
57
  run: >
58
- uv run mike deploy ${PUSH_DEPLOY}
58
+ uv run mike deploy ${PUSH_DEPLOY}
59
+ --update-aliases
59
60
  --branch gh-pages
60
61
  --alias-type symlink
61
62
  ${{ inputs.version }} ${{ inputs.alias }}
@@ -52,12 +52,13 @@ jobs:
52
52
  - name: Check next semantic version
53
53
  run: |
54
54
  uv sync --dev
55
- OUTPUT=$(uv run semantic-release --noop version --print)
56
- echo "$OUTPUT"
57
- if [ -z "$OUTPUT" ]; then
55
+ NEXT=$(uv run semantic-release --noop version --print-tag)
56
+ CURRENT=$(uv run semantic-release --noop version --print-last-released-tag)
57
+ echo "$NEXT"
58
+ if [ "$NEXT" = "$CURRENT" ]; then
58
59
  echo "comment=No release will be made." >> $GITHUB_ENV
59
60
  else
60
- echo "comment=The next release will be v$OUTPUT" >> $GITHUB_ENV
61
+ echo "comment=The next release will be $NEXT" >> $GITHUB_ENV
61
62
  fi
62
63
 
63
64
  - name: Find Comment
@@ -83,7 +83,7 @@ jobs:
83
83
  id: publish-dist
84
84
  uses: python-semantic-release/publish-action@v9.15.2
85
85
  with:
86
- github-token: ${{ steps.app-token.outputs.token }}
86
+ github_token: ${{ steps.app-token.outputs.token }}
87
87
  tag: ${{ steps.semantic-release.outputs.tag }}
88
88
 
89
89
  mkdocs:
@@ -1,6 +1,37 @@
1
1
  # CHANGELOG
2
2
 
3
3
 
4
+ ## v0.6.0 (2025-01-04)
5
+
6
+ ### Documentation
7
+
8
+ - Add api documentation ([#33](https://github.com/watermarkhu/mkdocstrings-matlab/pull/33),
9
+ [`62632e8`](https://github.com/watermarkhu/mkdocstrings-matlab/commit/62632e8c5447125e5d2bfb58202d0fcd0de51ab9))
10
+
11
+ - Add preview to docs index ([#32](https://github.com/watermarkhu/mkdocstrings-matlab/pull/32),
12
+ [`9289b11`](https://github.com/watermarkhu/mkdocstrings-matlab/commit/9289b118c7ca78bd3372a9559d140fa76ca89977))
13
+
14
+ - Better docs ([#34](https://github.com/watermarkhu/mkdocstrings-matlab/pull/34),
15
+ [`bf97320`](https://github.com/watermarkhu/mkdocstrings-matlab/commit/bf973203343098a139afe571d37daa35b3b6359c))
16
+
17
+ ### Features
18
+
19
+ - Show subnamespaces ([#36](https://github.com/watermarkhu/mkdocstrings-matlab/pull/36),
20
+ [`509e793`](https://github.com/watermarkhu/mkdocstrings-matlab/commit/509e7930f52f5656c9de1089daa4c0354ea170be))
21
+
22
+ * add option show_subnamespaces
23
+
24
+ * forward config
25
+
26
+
27
+ ## v0.5.0 (2025-01-03)
28
+
29
+ ### Features
30
+
31
+ - Force minor release ([#31](https://github.com/watermarkhu/mkdocstrings-matlab/pull/31),
32
+ [`96278d0`](https://github.com/watermarkhu/mkdocstrings-matlab/commit/96278d0ff1080bbb4ac102190653c0fa1a269664))
33
+
34
+
4
35
  ## v0.4.2 (2025-01-03)
5
36
 
6
37
  ### Bug Fixes
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mkdocstrings-matlab
3
- Version: 0.4.2
3
+ Version: 0.6.0
4
4
  Summary: A MATLAB handler for mkdocstrings
5
5
  Author-email: Mark Hu <watermarkhu@gmail.com>
6
6
  License: ISC
@@ -28,19 +28,20 @@ Requires-Dist: tree-sitter-matlab>=1.0.2
28
28
  Requires-Dist: tree-sitter>=0.23.2
29
29
  Description-Content-Type: text/markdown
30
30
 
31
+ <!-- --8<-- [start:header] -->
32
+
31
33
  <h1 align="center">mkdocstrings-matlab</h1>
32
34
 
33
35
  <p align="center">A MATLAB handler for <a href="https://github.com/mkdocstrings/mkdocstrings"><i>mkdocstrings</i></a>.</p>
34
36
 
37
+ <p align="center"><img width=300px src="logo.svg"></p>
38
+
35
39
  [![qualify](https://github.com/watermarkhu/mkdocstrings-matlab/actions/workflows/qualify.yaml/badge.svg)](https://github.com/watermarkhu/mkdocstrings-matlab/actions/workflows/qualify.yaml)
36
40
  [![documentation](https://img.shields.io/badge/docs-mkdocs-708FCC.svg?style=flat)](https://watermarkhu.nl/mkdocstrings-matlab)
37
41
  [![pypi version](https://img.shields.io/pypi/v/mkdocstrings-matlab.svg)](https://pypi.org/project/mkdocstrings-matlab/)
38
42
 
39
- <p align="center"><img width=300px src="logo.svg"></p>
40
-
41
43
  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/).
42
44
 
43
- ## Installation
44
45
 
45
46
  You can install this handler by specifying it as a dependency:
46
47
 
@@ -53,6 +54,9 @@ dependencies = [
53
54
  ]
54
55
  ```
55
56
 
57
+ <!-- --8<-- [end:header] -->
58
+ <!-- --8<-- [start:footer] -->
59
+
56
60
  ## Features
57
61
 
58
62
  - **Data collection from source code**: collection of the object-tree and the docstrings is done thanks to
@@ -63,7 +67,7 @@ dependencies = [
63
67
  It is even able to automatically add cross-references o other objects from your API.
64
68
 
65
69
  - **Recursive documentation of MATLAB [namespaces](https://mathworks.com/help/matlab/matlab_oop/namespaces.html):**
66
- 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.
70
+ 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.
67
71
 
68
72
  - **Support for documented properties:** properties definitions followed by a docstring will be recognized in classes.
69
73
 
@@ -79,4 +83,6 @@ dependencies = [
79
83
  you can reference other objects within your docstrings, with the classic Markdown syntax:
80
84
  `[this object][namespace.subnamespace.object]` or directly with `[namespace.subnamespace.object][]`
81
85
 
82
- - **Source code display:** *mkdocstrings* can add a collapsible div containing the highlighted source code of the MATLAB object.
86
+ - **Source code display:** *mkdocstrings* can add a collapsible div containing the highlighted source code of the MATLAB object.
87
+
88
+ <!-- --8<-- [end:footer] -->
@@ -1,16 +1,17 @@
1
+ <!-- --8<-- [start:header] -->
2
+
1
3
  <h1 align="center">mkdocstrings-matlab</h1>
2
4
 
3
5
  <p align="center">A MATLAB handler for <a href="https://github.com/mkdocstrings/mkdocstrings"><i>mkdocstrings</i></a>.</p>
4
6
 
7
+ <p align="center"><img width=300px src="logo.svg"></p>
8
+
5
9
  [![qualify](https://github.com/watermarkhu/mkdocstrings-matlab/actions/workflows/qualify.yaml/badge.svg)](https://github.com/watermarkhu/mkdocstrings-matlab/actions/workflows/qualify.yaml)
6
10
  [![documentation](https://img.shields.io/badge/docs-mkdocs-708FCC.svg?style=flat)](https://watermarkhu.nl/mkdocstrings-matlab)
7
11
  [![pypi version](https://img.shields.io/pypi/v/mkdocstrings-matlab.svg)](https://pypi.org/project/mkdocstrings-matlab/)
8
12
 
9
- <p align="center"><img width=300px src="logo.svg"></p>
10
-
11
13
  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/).
12
14
 
13
- ## Installation
14
15
 
15
16
  You can install this handler by specifying it as a dependency:
16
17
 
@@ -23,6 +24,9 @@ dependencies = [
23
24
  ]
24
25
  ```
25
26
 
27
+ <!-- --8<-- [end:header] -->
28
+ <!-- --8<-- [start:footer] -->
29
+
26
30
  ## Features
27
31
 
28
32
  - **Data collection from source code**: collection of the object-tree and the docstrings is done thanks to
@@ -33,7 +37,7 @@ dependencies = [
33
37
  It is even able to automatically add cross-references o other objects from your API.
34
38
 
35
39
  - **Recursive documentation of MATLAB [namespaces](https://mathworks.com/help/matlab/matlab_oop/namespaces.html):**
36
- 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.
40
+ 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.
37
41
 
38
42
  - **Support for documented properties:** properties definitions followed by a docstring will be recognized in classes.
39
43
 
@@ -49,4 +53,6 @@ dependencies = [
49
53
  you can reference other objects within your docstrings, with the classic Markdown syntax:
50
54
  `[this object][namespace.subnamespace.object]` or directly with `[namespace.subnamespace.object][]`
51
55
 
52
- - **Source code display:** *mkdocstrings* can add a collapsible div containing the highlighted source code of the MATLAB object.
56
+ - **Source code display:** *mkdocstrings* can add a collapsible div containing the highlighted source code of the MATLAB object.
57
+
58
+ <!-- --8<-- [end:footer] -->
@@ -0,0 +1,16 @@
1
+
2
+ !!! note
3
+
4
+ Due to that for the documentation of mkdocstrings-matlab both the MATLAB and the Python handler are loaded, the symbols shown for Python objects will be incorrect (see [Configuration](usage/index.md#configuration)).
5
+
6
+ ::: mkdocstrings_handlers.matlab
7
+ handler: python
8
+ options:
9
+ show_root_toc_entry: true
10
+ show_submodules: true
11
+ heading_level: 1
12
+ members:
13
+ - handler
14
+ - collect
15
+ - models
16
+ - treesitter
@@ -0,0 +1,34 @@
1
+ ---
2
+ hide:
3
+ - feedback
4
+ ---
5
+
6
+ --8<-- "README.md:header"
7
+
8
+ ## Preview
9
+
10
+ Let's us quickly see how auto-documentation works with mkdocstrings-matlab:
11
+
12
+ ```matlab title="Function making use of Argument Validation in namespace +mynamespace"
13
+ --8<-- "docs/snippets/+mynamespace/typed_function.m"
14
+ ```
15
+
16
+ <div class="result" markdown>
17
+
18
+ ![Image title](img/preview_dark.png#only-dark){ align=left width=400 }
19
+
20
+ ![Image title](img/preview_light.png#only-light){ align=left width=400 }
21
+
22
+ Given the function above, the rendered documentation here is created from the following markdown document file,
23
+
24
+ ```markdown title="docs/api.md"
25
+ ::: mynamespace.typed_function
26
+ options:
27
+ parse_arguments: true
28
+ ```
29
+
30
+
31
+
32
+ </div>
33
+
34
+ --8<-- "README.md:footer"
@@ -0,0 +1,8 @@
1
+ {% extends "base.html" %}
2
+
3
+ {% block outdated %}
4
+ You're not viewing the latest version.
5
+ <a href="{{ '../' ~ base_url }}">
6
+ <strong>Click here to go to latest.</strong>
7
+ </a>
8
+ {% endblock %}
@@ -0,0 +1,20 @@
1
+ <li class="md-nav__item">
2
+ <a href="{{ toc_item.url }}" class="md-nav__link">
3
+ <span class="md-ellipsis">
4
+ {{ toc_item.title }}
5
+ </span>
6
+ </a>
7
+
8
+ <!-- Table of contents list -->
9
+ {% if toc_item.children %}
10
+ <nav class="md-nav" aria-label="{{ toc_item.title | striptags }}">
11
+ <ul class="md-nav__list">
12
+ {% for toc_item in toc_item.children %}
13
+ {% if not page.meta.toc_depth or toc_item.level <= page.meta.toc_depth %}
14
+ {% include "partials/toc-item.html" %}
15
+ {% endif %}
16
+ {% endfor %}
17
+ </ul>
18
+ </nav>
19
+ {% endif %}
20
+ </li>
@@ -3,6 +3,11 @@
3
3
  --md-primary-fg-color--dark: #002f5b;
4
4
  }
5
5
 
6
+ [data-md-color-scheme="matlab"] img[src$="#only-dark"],
7
+ [data-md-color-scheme="matlab"] img[src$="#gh-dark-mode-only"] {
8
+ display: none; /* Hide dark images in light mode */
9
+ }
10
+
6
11
  /* Custom admonition: preview */
7
12
  :root {
8
13
  --md-admonition-icon--preview: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.5 12a3.5 3.5 0 1 1-7 0 3.5 3.5 0 0 1 7 0Z"/><path d="M12 3.5c3.432 0 6.124 1.534 8.054 3.241 1.926 1.703 3.132 3.61 3.616 4.46a1.6 1.6 0 0 1 0 1.598c-.484.85-1.69 2.757-3.616 4.461-1.929 1.706-4.622 3.24-8.054 3.24-3.432 0-6.124-1.534-8.054-3.24C2.02 15.558.814 13.65.33 12.8a1.6 1.6 0 0 1 0-1.598c.484-.85 1.69-2.757 3.616-4.462C5.875 5.034 8.568 3.5 12 3.5ZM1.633 11.945a.115.115 0 0 0-.017.055c.001.02.006.039.017.056.441.774 1.551 2.527 3.307 4.08C6.691 17.685 9.045 19 12 19c2.955 0 5.31-1.315 7.06-2.864 1.756-1.553 2.866-3.306 3.307-4.08a.111.111 0 0 0 .017-.056.111.111 0 0 0-.017-.056c-.441-.773-1.551-2.527-3.307-4.08C17.309 6.315 14.955 5 12 5 9.045 5 6.69 6.314 4.94 7.865c-1.756 1.552-2.866 3.306-3.307 4.08Z"/></svg>');
@@ -1,3 +1,7 @@
1
+ ---
2
+ toc_depth: 2
3
+ ---
4
+
1
5
  # Docstrings options
2
6
 
3
7
  ## `docstring_style`
@@ -607,12 +611,6 @@ plugins:
607
611
  show_docstring_namespaces: false
608
612
  ```
609
613
 
610
- ```tree
611
- module/
612
- __init__.py
613
- submodule.py
614
- ```
615
-
616
614
  --8<-- "docs/snippets/+module/module.md"
617
615
 
618
616
  ???+ preview
@@ -1,3 +1,7 @@
1
+ ---
2
+ toc_depth: 2
3
+ ---
4
+
1
5
  # General options
2
6
 
3
7
  ## `show_bases`
@@ -1,3 +1,7 @@
1
+ ---
2
+ toc_depth: 2
3
+ ---
4
+
1
5
  # Headings options
2
6
 
3
7
  ## `heading_level`
@@ -1,3 +1,7 @@
1
+ ---
2
+ toc_depth: 2
3
+ ---
4
+
1
5
  # Members options
2
6
 
3
7
  ## `members`
@@ -545,12 +549,69 @@ plugins:
545
549
  ```markdown
546
550
  ::: +mymembers
547
551
  options:
548
- group_by_category: False
552
+ group_by_category: false
549
553
  ```
550
554
 
551
555
  ::: +mymembers
552
556
  options:
553
- group_by_category: False
557
+ group_by_category: false
558
+
559
+ ## `show_subnamespaces`
560
+
561
+ - **:octicons-package-24: Type [`bool`][] :material-equal: `False`{ title="default value" }**
562
+
563
+ When rendering a namespace, show its subnamespaces recursively.
564
+
565
+ This is false by default, because most of the time we render only one namespace per page, and when rendering a full package (a tree of namespaces and their members) on a single page, we quickly run out of [heading levels][heading_level].
566
+
567
+ ```yaml title="in mkdocs.yml (global configuration)"
568
+ plugins:
569
+ - mkdocstrings:
570
+ handlers:
571
+ matlab:
572
+ options:
573
+ show_subnamespaces: true
574
+ ```
575
+
576
+ ```md title="or in docs/some_page.md (local configuration)"
577
+ ::: +matlab_namespace
578
+ options:
579
+ show_subnamespaces: false
580
+ ```
581
+
582
+ --8<-- "docs/snippets/+module/module.md"
583
+
584
+ ???+ preview
585
+
586
+ === "With show subnamespaces"
587
+
588
+ ```markdown
589
+ ::: +module
590
+ options:
591
+ show_subnamespaces: true
592
+ ```
593
+
594
+ ::: +module
595
+ options:
596
+ show_subnamespaces: true
597
+ show_docstring_namespaces: false
598
+ show_docstring_classes: false
599
+ show_docstring_functions: false
600
+
601
+ === "Without show subnamespaces"
602
+
603
+ ```markdown
604
+ ::: +module
605
+ options:
606
+ show_subnamespaces: false
607
+ ```
608
+
609
+ ::: +module
610
+ options:
611
+ show_subnamespaces: false
612
+ show_docstring_namespaces: false
613
+ show_docstring_classes: false
614
+ show_docstring_functions: false
554
615
 
555
616
  ## `summary`
556
617
 
@@ -1,3 +1,7 @@
1
+ ---
2
+ toc_depth: 2
3
+ ---
4
+
1
5
  # Signatures options
2
6
 
3
7
  ## `show_signature`
@@ -9,10 +9,12 @@ You can install this handler by specifying it as a dependency:
9
9
  # adapt to your dependencies manager
10
10
  [project]
11
11
  dependencies = [
12
- "mkdocstrings-matlab>=0.3",
12
+ "mkdocstrings-matlab>=0.X.Y",
13
13
  ]
14
14
  ```
15
15
 
16
+ ## Configuration
17
+
16
18
  For *mkdocstrings* the default will be the Python handler. You can change the default handler,
17
19
  or explicitely set the MATLAB handler as default by defining the `default_handler`
18
20
  configuration option of `mkdocstrings` in `mkdocs.yml`:
@@ -21,8 +23,25 @@ configuration option of `mkdocstrings` in `mkdocs.yml`:
21
23
  plugins:
22
24
  - mkdocstrings:
23
25
  default_handler: matlab
26
+ matlab:
27
+ ... # the MATLAB handler configuration
28
+ ```
29
+
30
+ When using the [material](https://squidfunk.github.io/mkdocs-material) theme, it is best to also configure the `mkdocs_material_matlab` plugin. This additional plugin, which is installed together with mkdocstrings-matlab, will overrule the symbols shown with [`show_symbol_type_heading`][] and [`show_symbol_type_toc`][] to show the correct symbols as per MATLAB nomenclature.
31
+
32
+ ```yaml title="mkdocs.yml"
33
+ plugins:
34
+ - mkdocs_material_matlab
35
+ - mkdocstrings:
36
+ default_handler: matlab
37
+ matlab:
38
+ ... # the MATLAB handler configuration
24
39
  ```
25
40
 
41
+ ??? warning "I want to document both MATLAB and Python"
42
+
43
+ The `mkdocs_material_matlab` plugin will also change the symbols for the Python handler. This means that Python modules will not be tagged with symbol `mod` but `name` (namespace), and attributes are not tagged with symbol `attr` but `prop` (property).
44
+
26
45
  ## Injecting documentation
27
46
 
28
47
  With the MATLAB handler installed and configured as default handler, you can inject documentation for a module, class, function, or any other MATLAB object with *mkdocstrings*' [autodoc syntax], in your Markdown pages:
@@ -40,13 +59,13 @@ If another handler was defined as default handler, you can explicitely ask for t
40
59
 
41
60
  Entire [namespaces](https://mathworks.com/help/matlab/matlab_oop/namespaces.html) can be fully documented by prefixing the `+` character to the namespace that is to be documented. E.g. the following namespace
42
61
 
43
- ```
62
+ ```tree
44
63
  +mynamespace
45
- |- Contents.m
46
- |- readme.md
47
- |- myclass.m
48
- |- +subnamespace
49
- | |- mfunction.m
64
+ Contents.m
65
+ readme.md
66
+ myclass.m
67
+ +subnamespace
68
+ mfunction.m
50
69
  ```
51
70
 
52
71
  is documented with:
@@ -64,17 +83,6 @@ Documenting a nested namespace requires only a single prefixed `+` at the start
64
83
  ::: +mynamespace.subnamespace
65
84
  ```
66
85
 
67
- ## Configuration
68
-
69
- When installed, the MATLAB handler becomes the default *mkdocstrings* handler. You can configure it in `mkdocs.yml`:
70
-
71
- ```yaml title="mkdocs.yml"
72
- plugins:
73
- - mkdocstrings:
74
- handlers:
75
- matlab:
76
- ... # the MATLAB handler configuration
77
- ```
78
86
 
79
87
  ### Global-only options
80
88
 
@@ -1,9 +1,8 @@
1
1
  site_name: "mkdocstrings-matlab"
2
2
  site_description: "A MATLAB handler for mkdocstrings."
3
- # site_url: "https://mkdocstrings.github.io/python"
3
+ site_url: "https://watermarkhu.nl/mkdocstrings-matlab"
4
4
  repo_url: "https://github.com/watermarkhu/mkdocstrings-matlab"
5
- repo_name: "watermarkhu/mkdocstrings-matlabn"
6
- site_dir: "site"
5
+ repo_name: "watermarkhu/mkdocstrings-matlab"
7
6
  watch: [mkdocs.yml, README.md, src/mkdocstrings_handlers]
8
7
  copyright: Copyright &copy; 2024 Mark Shui Hu
9
8
  edit_uri: edit/main/docs/
@@ -32,8 +31,9 @@ nav:
32
31
  - Numpy: usage/docstrings/numpy.md
33
32
  - Sphinx: usage/docstrings/sphinx.md
34
33
  # # defer to gen-files + literate-nav
35
- # - API reference:
36
- # - mkdocstrings-python: reference/
34
+ - API reference:
35
+ - mkdocstrings_handlers:
36
+ - matlab: api.md
37
37
  # - Development:
38
38
  # - Contributing: contributing.md
39
39
  # - Code of Conduct: code_of_conduct.md
@@ -48,6 +48,7 @@ nav:
48
48
  theme:
49
49
  name: material
50
50
  logo: logo.svg
51
+ custom_dir: docs/overrides
51
52
  features:
52
53
  - announce.dismiss
53
54
  - content.action.edit
@@ -123,17 +124,13 @@ markdown_extensions:
123
124
  custom_checkbox: true
124
125
  - toc:
125
126
  permalink: "¤"
126
- toc_depth: 2
127
+ toc_depth: 3
128
+
127
129
  plugins:
128
130
  - autorefs
129
131
  - search
130
132
  - markdown-exec
131
133
  - callouts
132
- # - gen-files:
133
- # scripts:
134
- # - scripts/gen_ref_nav.py
135
- # - literate-nav:
136
- # nav_file: SUMMARY.md
137
134
  - mkdocs-material-matlab
138
135
  - mkdocstrings:
139
136
  default_handler: matlab
@@ -177,13 +174,9 @@ plugins:
177
174
  show_signature_annotations: false
178
175
  separate_signature: false
179
176
  python:
180
- paths: [src, docs/snippets]
177
+ paths: [src]
181
178
  import:
182
179
  - https://docs.python.org/3/objects.inv
183
- - https://mkdocstrings.github.io/objects.inv
184
- - https://mkdocstrings.github.io/autorefs/objects.inv
185
- - https://mkdocstrings.github.io/griffe/objects.inv
186
- - https://python-markdown.github.io/objects.inv
187
180
  options:
188
181
  docstring_options:
189
182
  ignore_init_summary: true
@@ -193,7 +186,6 @@ plugins:
193
186
  inherited_members: true
194
187
  merge_init_into_class: true
195
188
  parameter_headings: true
196
- preload_modules: [mkdocstrings]
197
189
  relative_crossrefs: true
198
190
  scoped_crossrefs: true
199
191
  separate_signature: true
@@ -220,3 +212,7 @@ plugins:
220
212
  plugins:
221
213
  - typeset
222
214
 
215
+ extra:
216
+ version:
217
+ provider: mike
218
+ alias: true
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mkdocstrings-matlab"
3
- version = "0.4.2"
3
+ version = "0.6.0"
4
4
  description = "A MATLAB handler for mkdocstrings"
5
5
  authors = [
6
6
  { name = "Mark Hu", email = "watermarkhu@gmail.com" }
@@ -1,10 +1,11 @@
1
1
  """MATLAB handler for mkdocstrings."""
2
2
 
3
3
  from mkdocstrings_handlers.matlab.handler import get_handler
4
+ from mkdocstrings_handlers.matlab import collect, handler, models, treesitter
4
5
  from _griffe.enumerations import DocstringSectionKind
5
6
  from _griffe.docstrings import numpy, google
6
7
 
7
- __all__ = ["get_handler"]
8
+ __all__ = ["get_handler", "collect", "handler", "models", "treesitter"]
8
9
 
9
10
 
10
11
  # Add custom sections to the numpy and google docstring parsers
@@ -1,3 +1,5 @@
1
+ """Functions and classes for collecting MATLAB objects from paths."""
2
+
1
3
  from collections import defaultdict, deque
2
4
  from copy import copy, deepcopy
3
5
  from pathlib import Path
@@ -236,7 +238,7 @@ class PathCollection(ModulesCollection):
236
238
  case DocstringSectionKind.parameters:
237
239
  section.title = "Input arguments:"
238
240
  case DocstringSectionKind.returns:
239
- section.title= "Output arguments:"
241
+ section.title = "Output arguments:"
240
242
  case DocstringSectionKind.other_parameters:
241
243
  section.title = "Name-Value Arguments:"
242
244
 
@@ -1,3 +1,5 @@
1
+ """The mkdocstrings handler for processing MATLAB code documentation."""
2
+
1
3
  from pathlib import Path
2
4
  from collections import ChainMap
3
5
  from markdown import Markdown
@@ -51,6 +53,7 @@ class MatlabHandler(BaseHandler):
51
53
  "members_order": rendering.Order.alphabetical.value,
52
54
  "filters": ["!^delete$|^disp$"],
53
55
  "group_by_category": True,
56
+ "show_subnamespaces": False,
54
57
  "summary": False,
55
58
  "show_labels": True,
56
59
  # Docstring options
@@ -118,6 +121,7 @@ class MatlabHandler(BaseHandler):
118
121
  The `members` option takes precedence over `filters` (filters will still be applied recursively
119
122
  to lower members in the hierarchy). Default: `["!^delete$|^disp$"]`.
120
123
  group_by_category (bool): Group the object's children by categories: properties, classes, functions, and namespaces. Default: `True`.
124
+ show_subnamespaces (bool): When rendering a namespace, show its subnamespaces recursively. Default: `False`.
121
125
  summary (bool | dict[str, bool]): Whether to render summaries of namespaces, classes, functions (methods) and properties. Default: `False`.
122
126
  show_labels (bool): Whether to show labels of the members. Default: `True`.
123
127
 
@@ -249,6 +253,9 @@ class MatlabHandler(BaseHandler):
249
253
  }
250
254
 
251
255
  # Map docstring options
256
+ final_config["show_submodules"] = config.get(
257
+ "show_subnamespaces", False
258
+ )
252
259
  final_config["show_docstring_attributes"] = config.get(
253
260
  "show_docstring_properties", True
254
261
  )
@@ -1,3 +1,5 @@
1
+ """Classes to represent MATLAB objects and their properties."""
2
+
1
3
  from typing import Any, TYPE_CHECKING, Callable
2
4
  from functools import cached_property
3
5
  from pathlib import Path
@@ -1,4 +1,5 @@
1
- # %%
1
+ """Tree-sitter queries to extract information from MATLAB files."""
2
+
2
3
  from collections import OrderedDict
3
4
  from typing import Any
4
5
 
@@ -528,11 +528,11 @@ wheels = [
528
528
 
529
529
  [[package]]
530
530
  name = "importlib-resources"
531
- version = "6.5.0"
531
+ version = "6.5.2"
532
532
  source = { registry = "https://pypi.org/simple" }
533
- sdist = { url = "https://files.pythonhosted.org/packages/90/17/f0adf2fda7f289c2a6c0e7d66ab01a47de8f85f91b8c13b533ce74fe7fbc/importlib_resources-6.5.0.tar.gz", hash = "sha256:c5401947cdd2e60d426dc786e417cbbf20d0d9ab07d993b4c3cf714e271aed8b", size = 43525 }
533
+ sdist = { url = "https://files.pythonhosted.org/packages/cf/8c/f834fbf984f691b4f7ff60f50b514cc3de5cc08abfc3295564dd89c5e2e7/importlib_resources-6.5.2.tar.gz", hash = "sha256:185f87adef5bcc288449d98fb4fba07cea78bc036455dd44c5fc4a2fe78fed2c", size = 44693 }
534
534
  wheels = [
535
- { url = "https://files.pythonhosted.org/packages/13/0d/08d523ab5b9a0d6cd5d157019d8cca7c6ea40444f08be461cb959561cef6/importlib_resources-6.5.0-py3-none-any.whl", hash = "sha256:47cf6506b7900dcbde3ef334e41bf759a034e110269aa9793f0e624ddb2bf090", size = 35985 },
535
+ { url = "https://files.pythonhosted.org/packages/a4/ed/1f1afb2e9e7f38a545d628f864d562a5ae64fe6f7a10e28ffb9b185b4e89/importlib_resources-6.5.2-py3-none-any.whl", hash = "sha256:789cfdc3ed28c78b67a06acb8126751ced69a3d5f79c095a98298cd8a760ccec", size = 37461 },
536
536
  ]
537
537
 
538
538
  [[package]]
@@ -979,7 +979,7 @@ wheels = [
979
979
 
980
980
  [[package]]
981
981
  name = "mkdocstrings-matlab"
982
- version = "0.4.2"
982
+ version = "0.6.0"
983
983
  source = { editable = "." }
984
984
  dependencies = [
985
985
  { name = "charset-normalizer" },
@@ -1,6 +0,0 @@
1
- ---
2
- hide:
3
- - feedback
4
- ---
5
-
6
- --8<-- "README.md"