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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/.github/workflows/qualify.yaml +9 -3
  2. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/.github/workflows/release.yaml +2 -2
  3. mkdocstrings_matlab-0.8.0/.github/workflows/update-templates.yaml +48 -0
  4. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/.gitignore +1 -0
  5. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/CHANGELOG.md +40 -0
  6. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/PKG-INFO +9 -9
  7. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/README.md +4 -4
  8. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/api.md +0 -4
  9. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/index.md +0 -2
  10. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/usage/configuration/headings.md +21 -10
  11. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/usage/configuration/members.md +0 -5
  12. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/usage/index.md +45 -9
  13. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/mkdocs.yml +4 -8
  14. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/pyproject.toml +7 -13
  15. mkdocstrings_matlab-0.8.0/scripts/copy_and_update_python_templates.py +121 -0
  16. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/src/mkdocstrings_handlers/matlab/collect.py +84 -32
  17. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/src/mkdocstrings_handlers/matlab/handler.py +31 -10
  18. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/src/mkdocstrings_handlers/matlab/models.py +60 -28
  19. mkdocstrings_matlab-0.8.0/src/mkdocstrings_handlers/matlab/templates/material/children.html.jinja +172 -0
  20. mkdocstrings_matlab-0.8.0/src/mkdocstrings_handlers/matlab/templates/material/docstring/namespaces.html.jinja +86 -0
  21. mkdocstrings_matlab-0.8.0/src/mkdocstrings_handlers/matlab/templates/material/docstring/properties.html.jinja +109 -0
  22. mkdocstrings_matlab-0.8.0/src/mkdocstrings_handlers/matlab/templates/material/folder.html.jinja +121 -0
  23. mkdocstrings_matlab-0.8.0/src/mkdocstrings_handlers/matlab/templates/material/namespace.html.jinja +121 -0
  24. mkdocstrings_matlab-0.8.0/src/mkdocstrings_handlers/matlab/templates/material/property.html.jinja +120 -0
  25. mkdocstrings_matlab-0.8.0/src/mkdocstrings_handlers/matlab/templates/material/style.css +26 -0
  26. mkdocstrings_matlab-0.8.0/src/mkdocstrings_handlers/matlab/templates/material/summary/namespaces.html.jinja +21 -0
  27. mkdocstrings_matlab-0.8.0/src/mkdocstrings_handlers/matlab/templates/material/summary/properties.html.jinja +21 -0
  28. mkdocstrings_matlab-0.8.0/src/mkdocstrings_handlers/matlab/templates/material/summary.html.jinja +26 -0
  29. mkdocstrings_matlab-0.6.0/src/mkdocs_material_matlab/__init__.py +0 -4
  30. mkdocstrings_matlab-0.6.0/src/mkdocs_material_matlab/css/style.css +0 -7
  31. mkdocstrings_matlab-0.6.0/src/mkdocs_material_matlab/mkdocs_material_matlab.py +0 -20
  32. mkdocstrings_matlab-0.6.0/uv.lock +0 -2015
  33. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/.github/CODEOWNERS +0 -0
  34. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/.github/workflows/docs.yaml +0 -0
  35. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/.python-version +0 -0
  36. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/.vscode/launch.json +0 -0
  37. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/.vscode/settings.json +0 -0
  38. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/LICENSE +0 -0
  39. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/changelog.md +0 -0
  40. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/credits.md +0 -0
  41. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/debug.py +0 -0
  42. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/img/preview_dark.png +0 -0
  43. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/img/preview_light.png +0 -0
  44. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/license.md +0 -0
  45. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/logo.png +0 -0
  46. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/logo.svg +0 -0
  47. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/overrides/main.html +0 -0
  48. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/overrides/partials/toc-item.html +0 -0
  49. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/snippets/+module/+submodule/Contents.m +0 -0
  50. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/snippets/+module/+submodule/subfunction.m +0 -0
  51. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/snippets/+module/aClass.m +0 -0
  52. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/snippets/+module/do_something.m +0 -0
  53. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/snippets/+module/module.md +0 -0
  54. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/snippets/+module/readme.md +0 -0
  55. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/snippets/+mymembers/BaseClass.m +0 -0
  56. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/snippets/+mymembers/Contents.m +0 -0
  57. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/snippets/+mymembers/ThisClass.m +0 -0
  58. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/snippets/+mymembers/mymembers.md +0 -0
  59. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/snippets/+mymembers/this_function.m +0 -0
  60. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/snippets/+mynamespace/classA.m +0 -0
  61. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/snippets/+mynamespace/classB.m +0 -0
  62. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/snippets/+mynamespace/mynamespace.md +0 -0
  63. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/snippets/+mynamespace/readme.md +0 -0
  64. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/snippets/+mynamespace/typed_function.m +0 -0
  65. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/snippets/+undocumented/ClassWithoutDocstring.m +0 -0
  66. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/snippets/+undocumented/function_with_docstring.m +0 -0
  67. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/snippets/+undocumented/function_without_docstring.m +0 -0
  68. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/snippets/+undocumented/undocumented.md +0 -0
  69. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/snippets/Class.m +0 -0
  70. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/snippets/OtherClass.m +0 -0
  71. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/snippets/Thing.m +0 -0
  72. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/snippets/do_output.m +0 -0
  73. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/snippets/do_something.m +0 -0
  74. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/snippets/do_varargin.m +0 -0
  75. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/snippets/myClass.m +0 -0
  76. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/snippets/myParent.m +0 -0
  77. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/snippets/myfunction.m +0 -0
  78. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/snippets/print_hello.m +0 -0
  79. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/stylesheets/extra.css +0 -0
  80. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/usage/configuration/docstrings.md +0 -0
  81. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/usage/configuration/general.md +0 -0
  82. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/usage/configuration/signatures.md +0 -0
  83. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/usage/docstrings/google.md +0 -0
  84. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/usage/docstrings/numpy.md +0 -0
  85. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/docs/usage/docstrings/sphinx.md +0 -0
  86. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/logo.svg +0 -0
  87. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/renovate.json +0 -0
  88. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/requirements.lock +0 -0
  89. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/src/mkdocstrings_handlers/matlab/__init__.py +0 -0
  90. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/src/mkdocstrings_handlers/matlab/enums.py +0 -0
  91. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/src/mkdocstrings_handlers/matlab/py.typed +0 -0
  92. {mkdocstrings_matlab-0.6.0 → mkdocstrings_matlab-0.8.0}/src/mkdocstrings_handlers/matlab/treesitter.py +0 -0
@@ -10,6 +10,7 @@ on:
10
10
  - synchronize
11
11
  - labeled
12
12
  - unlabeled
13
+ - edited
13
14
  branches:
14
15
  - main
15
16
 
@@ -38,11 +39,16 @@ jobs:
38
39
  uses: actions/checkout@v4
39
40
  with:
40
41
  fetch-depth: 0
41
- ref: ${{ github.sha }}
42
+ ref: main
42
43
 
43
- - name: Force correct release branch on workflow sha
44
+ - name: Create fake commit with PR title
44
45
  run: |
45
- git checkout -B ${{ github.ref_name }} ${{ github.sha }}
46
+ git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
47
+ git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com'
48
+ git switch -c temp-${{ github.run_id }}
49
+ touch temp.txt
50
+ git add temp.txt
51
+ git commit -m "${{ github.event.pull_request.title }}"
46
52
 
47
53
  - name: Install the latest version of uv
48
54
  uses: astral-sh/setup-uv@v5
@@ -55,7 +55,7 @@ jobs:
55
55
 
56
56
  - name: Update version and changelogs
57
57
  id: semantic-release
58
- uses: python-semantic-release/python-semantic-release@v9.15.2
58
+ uses: python-semantic-release/python-semantic-release@v9.16.1
59
59
  with:
60
60
  build: false
61
61
  changelog: true
@@ -81,7 +81,7 @@ jobs:
81
81
  - name: Publish package distributions to GitHub Releases
82
82
  if: steps.semantic-release.outputs.released == 'true'
83
83
  id: publish-dist
84
- uses: python-semantic-release/publish-action@v9.15.2
84
+ uses: python-semantic-release/publish-action@v9.16.1
85
85
  with:
86
86
  github_token: ${{ steps.app-token.outputs.token }}
87
87
  tag: ${{ steps.semantic-release.outputs.tag }}
@@ -0,0 +1,48 @@
1
+ name: Update template copies
2
+
3
+ on:
4
+ pull_request:
5
+ types:
6
+ - opened
7
+ - synchronize
8
+ - reopened
9
+ - edited
10
+
11
+ permissions:
12
+ contents: write
13
+
14
+ jobs:
15
+ update-templates:
16
+ runs-on: ubuntu-latest
17
+ if: contains(github.event.pull_request.title, 'mkdocstrings-python')
18
+
19
+ steps:
20
+
21
+ - name: Checkout repository
22
+ uses: actions/checkout@v4
23
+ with:
24
+ fetch-depth: 0
25
+ ref: ${{ github.sha }}
26
+
27
+ - name: Force correct release branch on workflow sha
28
+ run: |
29
+ git checkout -B ${{ github.ref_name }} ${{ github.sha }}
30
+
31
+ - name: Install the latest version of uv
32
+ uses: astral-sh/setup-uv@v5
33
+ with:
34
+ version: "latest"
35
+
36
+ - name: Run script
37
+ run: |
38
+ uv sync
39
+ uv run python scripts/copy_and_update_python_templates.py
40
+
41
+ - name: Commit changes
42
+ continue-on-error: true # Ignore if there are no changes
43
+ run: |
44
+ git config --global user.name 'github-actions[bot]'
45
+ git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
46
+ git add .
47
+ git commit -m "Update templates"
48
+ git push origin ${{ github.ref_name }}
@@ -122,6 +122,7 @@ celerybeat.pid
122
122
  *.sage.py
123
123
 
124
124
  # Environments
125
+ uv.lock
125
126
  .env
126
127
  .venv
127
128
  env/
@@ -1,6 +1,46 @@
1
1
  # CHANGELOG
2
2
 
3
3
 
4
+ ## v0.8.0 (2025-01-13)
5
+
6
+ ### Features
7
+
8
+ - Update dependencies ([#46](https://github.com/watermarkhu/mkdocstrings-matlab/pull/46),
9
+ [`03229a2`](https://github.com/watermarkhu/mkdocstrings-matlab/commit/03229a2e7ef8ee46dc680b676a796ae38c6617b7))
10
+
11
+
12
+ ## v0.7.0 (2025-01-12)
13
+
14
+ ### Chores
15
+
16
+ - **deps**: Update python-semantic-release/publish-action action to v9.16.0
17
+ ([#38](https://github.com/watermarkhu/mkdocstrings-matlab/pull/38),
18
+ [`fc404c4`](https://github.com/watermarkhu/mkdocstrings-matlab/commit/fc404c46af2830eaba288beb8635092174a21b3b))
19
+
20
+ Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
21
+
22
+ - **deps**: Update python-semantic-release/python-semantic-release action to v9.16.0
23
+ ([#39](https://github.com/watermarkhu/mkdocstrings-matlab/pull/39),
24
+ [`56e8f87`](https://github.com/watermarkhu/mkdocstrings-matlab/commit/56e8f877d357deeaee3eb6cf31bee2b064ee2438))
25
+
26
+ Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
27
+
28
+ Co-authored-by: Mark Shui Hu <watermarkhu@gmail.com>
29
+
30
+ ### Features
31
+
32
+ - Folder modules ([#37](https://github.com/watermarkhu/mkdocstrings-matlab/pull/37),
33
+ [`81b551d`](https://github.com/watermarkhu/mkdocstrings-matlab/commit/81b551d794804212c18645926d58121cf556c79d))
34
+
35
+ * remove redundant root object
36
+
37
+ * feat: document folders
38
+
39
+ * uv format
40
+
41
+ * docs: update readme
42
+
43
+
4
44
  ## v0.6.0 (2025-01-04)
5
45
 
6
46
  ### Documentation
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mkdocstrings-matlab
3
- Version: 0.6.0
3
+ Version: 0.8.0
4
4
  Summary: A MATLAB handler for mkdocstrings
5
5
  Author-email: Mark Hu <watermarkhu@gmail.com>
6
- License: ISC
6
+ License: MIT
7
7
  License-File: LICENSE
8
8
  Classifier: Development Status :: 4 - Beta
9
9
  Classifier: Intended Audience :: Developers
@@ -21,11 +21,11 @@ Classifier: Topic :: Software Development :: Documentation
21
21
  Classifier: Topic :: Utilities
22
22
  Classifier: Typing :: Typed
23
23
  Requires-Python: >=3.10
24
- Requires-Dist: charset-normalizer>=3.3.2
24
+ Requires-Dist: charset-normalizer==3.4.1
25
25
  Requires-Dist: mkdocstrings-python==1.13.0
26
26
  Requires-Dist: mkdocstrings==0.27.0
27
- Requires-Dist: tree-sitter-matlab>=1.0.2
28
- Requires-Dist: tree-sitter>=0.23.2
27
+ Requires-Dist: tree-sitter-matlab==1.0.3
28
+ Requires-Dist: tree-sitter==0.23.2
29
29
  Description-Content-Type: text/markdown
30
30
 
31
31
  <!-- --8<-- [start:header] -->
@@ -40,7 +40,7 @@ Description-Content-Type: text/markdown
40
40
  [![documentation](https://img.shields.io/badge/docs-mkdocs-708FCC.svg?style=flat)](https://watermarkhu.nl/mkdocstrings-matlab)
41
41
  [![pypi version](https://img.shields.io/pypi/v/mkdocstrings-matlab.svg)](https://pypi.org/project/mkdocstrings-matlab/)
42
42
 
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/).
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. The AST information are imported as custom [Griffe](https://mkdocstrings.github.io/griffe/) objects and mocked for the [python handler](https://mkdocstrings.github.io/python/).
44
44
 
45
45
 
46
46
  You can install this handler by specifying it as a dependency:
@@ -64,10 +64,10 @@ dependencies = [
64
64
 
65
65
  - **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)
66
66
  blocks to display input and output argument types and default values.
67
- It is even able to automatically add cross-references o other objects from your API.
67
+ It is even able to automatically add cross-references to other objects from your API.
68
68
 
69
- - **Recursive documentation of MATLAB [namespaces](https://mathworks.com/help/matlab/matlab_oop/namespaces.html):**
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.
69
+ - **Recursive documentation of MATLAB [namespaces](https://mathworks.com/help/matlab/matlab_oop/namespaces.html) and folders:**
70
+ just add `+` to the identifer for namespaces or the relative path for folder, and you get documentation for the entire directory. You don't need to inject documentation for each class, function, and script. Additionaly, the directory documentation will be either extracted from the `Contents.m` or the `readme.md` file at the root of the namespace or folder.
71
71
 
72
72
  - **Support for documented properties:** properties definitions followed by a docstring will be recognized in classes.
73
73
 
@@ -10,7 +10,7 @@
10
10
  [![documentation](https://img.shields.io/badge/docs-mkdocs-708FCC.svg?style=flat)](https://watermarkhu.nl/mkdocstrings-matlab)
11
11
  [![pypi version](https://img.shields.io/pypi/v/mkdocstrings-matlab.svg)](https://pypi.org/project/mkdocstrings-matlab/)
12
12
 
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/).
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. The AST information are imported as custom [Griffe](https://mkdocstrings.github.io/griffe/) objects and mocked for the [python handler](https://mkdocstrings.github.io/python/).
14
14
 
15
15
 
16
16
  You can install this handler by specifying it as a dependency:
@@ -34,10 +34,10 @@ dependencies = [
34
34
 
35
35
  - **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)
36
36
  blocks to display input and output argument types and default values.
37
- It is even able to automatically add cross-references o other objects from your API.
37
+ It is even able to automatically add cross-references to other objects from your API.
38
38
 
39
- - **Recursive documentation of MATLAB [namespaces](https://mathworks.com/help/matlab/matlab_oop/namespaces.html):**
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.
39
+ - **Recursive documentation of MATLAB [namespaces](https://mathworks.com/help/matlab/matlab_oop/namespaces.html) and folders:**
40
+ just add `+` to the identifer for namespaces or the relative path for folder, and you get documentation for the entire directory. You don't need to inject documentation for each class, function, and script. Additionaly, the directory documentation will be either extracted from the `Contents.m` or the `readme.md` file at the root of the namespace or folder.
41
41
 
42
42
  - **Support for documented properties:** properties definitions followed by a docstring will be recognized in classes.
43
43
 
@@ -1,8 +1,4 @@
1
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
2
  ::: mkdocstrings_handlers.matlab
7
3
  handler: python
8
4
  options:
@@ -27,8 +27,6 @@ Given the function above, the rendered documentation here is created from the fo
27
27
  parse_arguments: true
28
28
  ```
29
29
 
30
-
31
-
32
30
  </div>
33
31
 
34
32
  --8<-- "README.md:footer"
@@ -553,13 +553,17 @@ plugins:
553
553
  === "With symbol type in headings"
554
554
 
555
555
  ```markdown
556
- ::: +mynamespace
556
+ ::: docs/snippets
557
557
  options:
558
+ members:
559
+ - mynamespace
558
560
  show_symbol_type_heading: true
559
561
  ```
560
562
 
561
- ::: +mynamespace
563
+ ::: docs/snippets
562
564
  options:
565
+ members:
566
+ - mynamespace
563
567
  show_symbol_type_heading: true
564
568
  show_docstring_input_arguments: false
565
569
  show_docstring_output_arguments: false
@@ -567,13 +571,17 @@ plugins:
567
571
  === "Without symbol type in headings"
568
572
 
569
573
  ```markdown
570
- ::: +mynamespace
574
+ ::: docs/snippets
571
575
  options:
576
+ members:
577
+ - mynamespace
572
578
  show_symbol_type_heading: false
573
579
  ```
574
580
 
575
- ::: +mynamespace
581
+ ::: docs/snippets
576
582
  options:
583
+ members:
584
+ - mynamespace
577
585
  show_symbol_type_heading: false
578
586
  show_docstring_input_arguments: false
579
587
  show_docstring_output_arguments: false
@@ -586,11 +594,12 @@ plugins:
586
594
  Show the symbol type in the Table of Contents.
587
595
 
588
596
  This option will prefix items in the ToC with
589
- <code class="doc-symbol doc-symbol-attribute"></code>,
597
+ <code class="doc-symbol doc-symbol-property"></code>,
590
598
  <code class="doc-symbol doc-symbol-function"></code>,
591
599
  <code class="doc-symbol doc-symbol-method"></code>,
592
- <code class="doc-symbol doc-symbol-class"></code> or
593
- <code class="doc-symbol doc-symbol-module"></code> types.
600
+ <code class="doc-symbol doc-symbol-class"></code>,
601
+ <code class="doc-symbol doc-symbol-namespace"></code> or.
602
+ <code class="doc-symbol doc-symbol-folder"></code> types.
594
603
  See also [`show_symbol_type_heading`][show_symbol_type_heading].
595
604
 
596
605
  ```yaml title="in mkdocs.yml (global configuration)"
@@ -603,7 +612,7 @@ plugins:
603
612
  show_symbol_type_toc: true
604
613
  ```
605
614
 
606
- 1. :warning: When using material theme, make sure to also enable the plugin `mkdocs-material-matlab` such that the right heading types are displayed. Otherwise, <code class="doc-symbol doc-symbol-attribute"></code> will be shown as `attr` and <code class="doc-symbol doc-symbol-module"></code> will be shown as `mod`, as the mkdocstrings-matlab plugin is reusing assets from mkdocstrings-python.
615
+ 1. :warning: When using material theme, make sure to also enable the plugin `mkdocs-material-matlab` such that the right heading types are displayed.
607
616
 
608
617
 
609
618
  ```md title="or in docs/some_page.md (local configuration)"
@@ -617,12 +626,13 @@ plugins:
617
626
  === "With symbol type in ToC"
618
627
 
619
628
  <ul style="list-style: none;">
620
- <li><code class="doc-symbol doc-symbol-module"></code> namespace</li>
629
+ <li><code class="doc-symbol doc-symbol-folder"></code> folder</li>
630
+ <li><code class="doc-symbol doc-symbol-namespace"></code> namespace</li>
621
631
  <li><code class="doc-symbol doc-symbol-function"></code> function</li>
622
632
  <li><code class="doc-symbol doc-symbol-class"></code> Class
623
633
  <ul style="list-style: none;">
624
634
  <li><code class="doc-symbol doc-symbol-method"></code> method</li>
625
- <li><code class="doc-symbol doc-symbol-attribute"></code> property</li>
635
+ <li><code class="doc-symbol doc-symbol-property"></code> property</li>
626
636
  </ul>
627
637
  </li>
628
638
  </ul>
@@ -630,6 +640,7 @@ plugins:
630
640
  === "Without symbol type in ToC"
631
641
 
632
642
  <ul style="list-style: none;">
643
+ <li>folder</li>
633
644
  <li>namespace</li>
634
645
  <li>function</li>
635
646
  <li>Class
@@ -700,11 +700,6 @@ plugins:
700
700
  summary:
701
701
  functions: true
702
702
 
703
- !!! warning
704
-
705
- In the summary, the title of the properties summary will be *attributes*, and the title of the namespaces summary will be *modules*. This is due to mkdocstrings-matlab's dependency on mkdocstrings-python. For now, mkdocstrings-matlab does not implement its own Jinja templates for rendering, leading to these summary titles.
706
-
707
-
708
703
  ## `show_labels`
709
704
 
710
705
  - **:octicons-package-24: Type [`bool`][] :material-equal: `True`{ title="default value" }**
@@ -27,21 +27,14 @@ plugins:
27
27
  ... # the MATLAB handler configuration
28
28
  ```
29
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
30
  ```yaml title="mkdocs.yml"
33
31
  plugins:
34
- - mkdocs_material_matlab
35
32
  - mkdocstrings:
36
33
  default_handler: matlab
37
34
  matlab:
38
35
  ... # the MATLAB handler configuration
39
36
  ```
40
37
 
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
-
45
38
  ## Injecting documentation
46
39
 
47
40
  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:
@@ -56,6 +49,7 @@ If another handler was defined as default handler, you can explicitely ask for t
56
49
  ::: path.to.object
57
50
  handler: matlab
58
51
  ```
52
+ ### Namespaces
59
53
 
60
54
  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
61
55
 
@@ -74,8 +68,7 @@ is documented with:
74
68
  ::: +mynamespace
75
69
  ```
76
70
 
77
- The docstring of the namespace is taken from either the [`Contents.m`](https://mathworks.com/help/matlab/matlab_prog/create-a-help-summary-contents-m.html) or a `readme.md` that resides at the root level of the namespace, with `Contents.m` taking precedence over `readme.md`.
78
-
71
+ The docstring of the namespace is taken from either the [`Contents.m`](https://mathworks.com/help/matlab/matlab_prog/create-a-help-summary-contents-m.html) or a `readme.md` that resides at the root level of the namespace, with `Contents.m` taking precedence over `readme.md`.
79
72
 
80
73
  Documenting a nested namespace requires only a single prefixed `+` at the start of the fully resolved path, e.g.
81
74
 
@@ -83,6 +76,49 @@ Documenting a nested namespace requires only a single prefixed `+` at the start
83
76
  ::: +mynamespace.subnamespace
84
77
  ```
85
78
 
79
+ ### Folders
80
+
81
+ Similarly to namepaces, all contents of a folder can be fully documented by specifying the relative path of a folder with respect to the `mkdocs.yml` config file. E.g. the following repository
82
+
83
+ ```tree
84
+ src
85
+ module
86
+ myfunction.m
87
+ myClass.m
88
+ submodule
89
+ myfunction.m
90
+ +mynamespace
91
+ namespacefunction.m
92
+ docs
93
+ index.md
94
+ mkdocs.yml
95
+ ```
96
+
97
+ is documented with:
98
+
99
+ ```markdown
100
+ ::: src/module
101
+ ```
102
+
103
+ In the case above the function `module/submodule/myfunction.m` overshadows the function `module/myfunction.m` on the MATLAB path. This means that in the global namespace myfunction will always call `module/submodule/myfunction.m`, which is the function to be documented by `::: myfunction`.
104
+
105
+ While this kind of behavior is strictly recommended against, mkdocstrings-matlab does support documenting the shadowed function by using its path. The file extension is now stricty required.
106
+
107
+ ```markdown
108
+ ::: src/module/myfunction.m
109
+ ```
110
+
111
+ !!! tip
112
+
113
+ A folder identifier must strictly contain the `/` character. For a folder `foo` that is in the same directory with `mkdocs.yml`, use `::: ./foo`.
114
+
115
+ !!! tip
116
+
117
+ If the `mkdocs.yml` lives inside of a subdirectly that does not contain source code, use relative paths e.g. `../src/module`.
118
+
119
+ !!! tip
120
+
121
+ Sub-selecting folder members are possible with the [members](./configuration/members.md) options.
86
122
 
87
123
  ### Global-only options
88
124
 
@@ -127,11 +127,10 @@ markdown_extensions:
127
127
  toc_depth: 3
128
128
 
129
129
  plugins:
130
+ - callouts
130
131
  - autorefs
131
132
  - search
132
133
  - markdown-exec
133
- - callouts
134
- - mkdocs-material-matlab
135
134
  - mkdocstrings:
136
135
  default_handler: matlab
137
136
  handlers:
@@ -201,16 +200,13 @@ plugins:
201
200
  summary: true
202
201
  unwrap_annotated: true
203
202
 
203
+ - minify:
204
+ minify_html: !ENV [DEPLOY, false]
205
+
204
206
  - git-revision-date-localized:
205
207
  enabled: !ENV [DEPLOY, false]
206
208
  enable_creation_date: true
207
209
  type: timeago
208
- - minify:
209
- minify_html: !ENV [DEPLOY, false]
210
- - group:
211
- enabled: !ENV [MATERIAL_INSIDERS, false]
212
- plugins:
213
- - typeset
214
210
 
215
211
  extra:
216
212
  version:
@@ -1,19 +1,19 @@
1
1
  [project]
2
2
  name = "mkdocstrings-matlab"
3
- version = "0.6.0"
3
+ version = "0.8.0"
4
4
  description = "A MATLAB handler for mkdocstrings"
5
5
  authors = [
6
6
  { name = "Mark Hu", email = "watermarkhu@gmail.com" }
7
7
  ]
8
- license = { text = "ISC" }
8
+ license = { text = "MIT" }
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
11
11
  dependencies = [
12
12
  "mkdocstrings==0.27.0",
13
- "mkdocstrings-python==1.13.0", # Later versions will currently break
14
- "charset-normalizer>=3.3.2",
15
- "tree-sitter>=0.23.2",
16
- "tree-sitter-matlab>=1.0.2",
13
+ "mkdocstrings-python==1.13.0",
14
+ "charset-normalizer==3.4.1",
15
+ "tree-sitter==0.23.2",
16
+ "tree-sitter-matlab==1.0.3",
17
17
  ]
18
18
  classifiers = [
19
19
  "Development Status :: 4 - Beta",
@@ -44,19 +44,13 @@ managed = true
44
44
  allow-direct-references = true
45
45
 
46
46
  [tool.hatch.build.targets.wheel]
47
- packages = ["src/mkdocstrings_handlers", "src/mkdocs_material_matlab"]
48
-
49
- [project.entry-points."mkdocs.plugins"]
50
- mkdocs-material-matlab = "mkdocs_material_matlab:MkdocsMaterialMatlabPlugin"
47
+ packages = ["src/mkdocstrings_handlers"]
51
48
 
52
49
  [dependency-groups]
53
50
  docs = [
54
51
  "mkdocs-material>=9.5.33",
55
52
  "markdown-exec>=1.10.0",
56
53
  "mkdocs-callouts>=1.15.0",
57
- "mkdocs-with-pdf>=0.9.3",
58
- "mkdocs-gen-files>=0.5.0",
59
- "mkdocs-literate-nav>=0.6.1",
60
54
  "mkdocs-git-revision-date-localized-plugin>=1.3.0",
61
55
  "mkdocs-minify-plugin>=0.8.0",
62
56
  "mike>=2.1.3",
@@ -0,0 +1,121 @@
1
+ """A script to copy the modules and attributes templates from
2
+ the python handler to the matlab handler and update the names"""
3
+
4
+ from mkdocstrings_handlers.python.handler import PythonHandler
5
+ from pathlib import Path
6
+ import re
7
+
8
+ # Get the templates directory of the python handler
9
+ pythonHandler = PythonHandler("python", "material")
10
+ templatesDir = pythonHandler.get_templates_dir()
11
+ targetDir = (
12
+ Path(__file__).parent.parent
13
+ / "src"
14
+ / "mkdocstrings_handlers"
15
+ / "matlab"
16
+ / "templates"
17
+ )
18
+
19
+
20
+ def copy_template(
21
+ sourcePath: str,
22
+ targetPath: str,
23
+ mapping: dict[str, str] = {},
24
+ theme: str = "material",
25
+ ):
26
+ sourceFile = templatesDir / theme / sourcePath
27
+ targetFile = targetDir / theme / targetPath
28
+ content = sourceFile.read_text()
29
+ pattern = re.compile(
30
+ "|".join([re.escape(k) for k in sorted(mapping, key=len, reverse=True)]),
31
+ flags=re.DOTALL,
32
+ )
33
+ content = pattern.sub(lambda x: mapping[x.group(0)], content)
34
+ targetFile.write_text(content)
35
+
36
+ return (targetFile, content)
37
+
38
+
39
+ # Copy the namespace and module templates
40
+ copy_template(
41
+ "_base/module.html.jinja",
42
+ "folder.html.jinja",
43
+ {"doc-symbol-module": "doc-symbol-folder"},
44
+ )
45
+ copy_template(
46
+ "_base/module.html.jinja",
47
+ "namespace.html.jinja",
48
+ {"doc-symbol-module": "doc-symbol-namespace"},
49
+ )
50
+
51
+ # Copy the property template
52
+ copy_template(
53
+ "_base/attribute.html.jinja",
54
+ "property.html.jinja",
55
+ {"doc-symbol-attribute": "doc-symbol-property"},
56
+ )
57
+
58
+ # Copy the summary modules template
59
+ copy_template(
60
+ "_base/summary.html.jinja",
61
+ "summary.html.jinja",
62
+ {
63
+ "summary/modules": "summary/namespaces",
64
+ "summary/attributes": "summary/properties",
65
+ },
66
+ )
67
+
68
+
69
+ ## Copy the summary properties template
70
+ copy_template(
71
+ "_base/summary/attributes.html.jinja",
72
+ "summary/properties.html.jinja",
73
+ {
74
+ "docstring/attributes": "docstring/properties",
75
+ "Summary of attributes": "Summary of properties",
76
+ },
77
+ )
78
+ copy_template(
79
+ "_base/docstring/attributes.html.jinja",
80
+ "docstring/properties.html.jinja",
81
+ {
82
+ 'lang.t("Attributes:")': '"Properties:"',
83
+ 'lang.t("ATTRIBUTE")': '"PROPERTY:"',
84
+ " attributes ": " properties ",
85
+ '"Attributes"': '"Properties"',
86
+ },
87
+ )
88
+
89
+ ## Copy the summary namespaces template
90
+ copy_template(
91
+ "_base/summary/modules.html.jinja",
92
+ "summary/namespaces.html.jinja",
93
+ {
94
+ "docstring/modules": "docstring/namespaces",
95
+ "Summary of modules": "Summary of namespaces",
96
+ },
97
+ )
98
+ copy_template(
99
+ "_base/docstring/modules.html.jinja",
100
+ "docstring/namespaces.html.jinja",
101
+ {
102
+ 'lang.t("Modules:")': '"Namespaces:"',
103
+ 'lang.t("MODULE")': '"NAMESPACE:"',
104
+ " modules ": " namespaces ",
105
+ '"Modules"': '"Namespaces"',
106
+ },
107
+ )
108
+
109
+ ## Copy children template
110
+ copy_template(
111
+ "_base/children.html.jinja",
112
+ "children.html.jinja",
113
+ {
114
+ "-attributes": "-properties",
115
+ "Attributes": "Properties",
116
+ "-modules": "-namespaces",
117
+ "Modules": "Modules",
118
+ "{% if config.show_submodules %}": "{% if config.show_submodules or obj.is_folder %}",
119
+ "{% elif child.is_module and config.show_submodules %}": "{% elif (child.is_namespace and config.show_submodules) or obj.is_folder %}",
120
+ },
121
+ )