All Projects → sphinx-contrib → matlabdomain

sphinx-contrib / matlabdomain

Licence: other
A Sphinx extension for documenting Matlab code

Programming Languages

python
139335 projects - #7 most used programming language
matlab
3953 projects
Batchfile
5799 projects
Makefile
30231 projects

Projects that are alternatives of or similar to matlabdomain

emojicodes
An extension to use emoji codes in your Sphinx documentation! 😍
Stars: ✭ 39 (+14.71%)
Mutual labels:  sphinx, sphinxcontrib, sphinx-extension
sphinx-wavedrom
A sphinx extension that allows including wavedrom diagrams by using its text-based representation
Stars: ✭ 26 (-23.53%)
Mutual labels:  sphinx, sphinx-extension
sphinxcontrib-programoutput
Sphinx extension for capturing program output
Stars: ✭ 29 (-14.71%)
Mutual labels:  sphinx, sphinx-extension
sphinxcontrib-django
This is a sphinx extension which improves the documentation of Django apps.
Stars: ✭ 37 (+8.82%)
Mutual labels:  sphinx, sphinx-extension
openapi
OpenAPI (fka Swagger) spec renderer for Sphinx.
Stars: ✭ 78 (+129.41%)
Mutual labels:  sphinx, sphinx-extension
autodoc pydantic
Seamlessly integrate pydantic models in your Sphinx documentation.
Stars: ✭ 60 (+76.47%)
Mutual labels:  sphinx, sphinx-extension
sphinx-revealjs
Presentation builder for Pythonista
Stars: ✭ 56 (+64.71%)
Mutual labels:  sphinx, sphinx-extension
sphinx-codeautolink
Automatic links from code examples to reference documentation
Stars: ✭ 41 (+20.59%)
Mutual labels:  sphinx, sphinx-extension
autoprogram
Documenting CLI programs
Stars: ✭ 37 (+8.82%)
Mutual labels:  sphinxcontrib, sphinx-extension
httpdomain
Documenting RESTful HTTP APIs
Stars: ✭ 51 (+50%)
Mutual labels:  sphinxcontrib, sphinx-extension
sphinx-hoverxref
Sphinx extension to show tooltips with content embedded when hover a reference.
Stars: ✭ 77 (+126.47%)
Mutual labels:  sphinx, sphinx-extension
sphinxcontrib-hdl-diagrams
Sphinx Extension which generates various types of diagrams from Verilog code.
Stars: ✭ 37 (+8.82%)
Mutual labels:  sphinx, sphinx-extension
sphinx-toolbox
Box of handy tools for Sphinx 🧰 📔
Stars: ✭ 55 (+61.76%)
Mutual labels:  sphinx, sphinx-extension
sphinx rtd dark mode
Adds a toggleable dark mode to the Read the Docs theme for Sphinx.
Stars: ✭ 29 (-14.71%)
Mutual labels:  sphinx, sphinx-extension
sphinx-server
Sphinx documentation Docker image with Python server and support for PlantUML and more.
Stars: ✭ 62 (+82.35%)
Mutual labels:  sphinx
readthedocs-sphinx-search
Enable search-as-you-type feature for docs hosted by RTD.
Stars: ✭ 24 (-29.41%)
Mutual labels:  sphinx-extension
plantuml
No description or website provided.
Stars: ✭ 87 (+155.88%)
Mutual labels:  sphinx-extension
choldgraf.github.io
Website
Stars: ✭ 33 (-2.94%)
Mutual labels:  sphinx
restbuilder
A Sphinx builder/writer to output reStructuredText (rst) files
Stars: ✭ 25 (-26.47%)
Mutual labels:  sphinx-extension
houdini additional python docs
🐍 Additional documentation of Houdini Python modules
Stars: ✭ 21 (-38.24%)
Mutual labels:  sphinx
Github Actions github-action-badge

sphinxcontrib-matlabdomain -- Sphinx domain for auto-documenting MATLAB

This extension provides a Sphinx domain for automatically generating doumentation from MATLAB source files. It is modelled after the Python autodoc.

The extension allows you to have your documentation and source files together and use the powerful Sphinx documentation tool. All your MATLAB file help text can be automatically included in the your documentation and output as for instance HTML.

The extension works really well with sphinx.ext.napoleon.

Recent Changes.

Usage

The Python package must be installed with:

pip install -U sphinxcontrib-matlabdomain

In general, the usage is the same as for documenting Python code. The package requires Python >= 3.6 and Sphinx >= 4.0.0.

For a Python 2 compatible version the package must be installed with:

pip install sphinxcontrib-matlabdomain==0.11.8

Configuration

In your Sphinx conf.py file add sphinxcontrib.matlab to the list of extensions.

extensions = ['sphinxcontrib.matlab', 'sphinx.ext.autodoc']

Additional Configuration

matlab_src_dir
In order for the Sphinx MATLAB domain to auto-document MATLAB source code, set the config value of matlab_src_dir to the absolute path. Currently only one MATLAB path can be specified, but all subfolders in that tree will be searched.
matlab_src_encoding
The encoding of the MATLAB files. By default, the files will be read as utf-8 and parsing errors will be replaced using ? chars.
matlab_keep_package_prefix
Determines if the MATLAB package prefix + is displayed in the generated documentation. Default is true. When false, packages are still referred to in ReST using +pakage.+subpkg.func but the output will be pakage.other.func().

For convenience the primary domain can be set to mat.

Roles and Directives

Please see Sphinx Domains and sphinx.ext.autodoc for documentation on the use of roles and directives. MATLAB code can be documented using the following roles and directives:

Directive MATLAB object
.. module:: foldername folders, packages and namespaces
.. currentmodule:: foldername
  • set folder but do not link
.. automodule:: foldername
  • auto-document
:mod:`foldername`
  • reference
.. function:: funcname function definition and signature
.. autofunction:: funcname()
  • auto-document
:func:`funcname`
  • reference
.. script:: scriptname script definition
.. autoscript:: scriptname
  • auto-document
:scpt:`scriptname`
  • reference
.. class:: classname() class definition and optional signature
.. autoclass:: classname
  • auto-document
:class:`classname`
  • reference
.. method:: methname() method definition and signature
.. automethod:: methname
  • auto-document
:meth:`methname`
  • reference
.. staticmethod:: statmethname() static method definition and signature
.. automethod:: statmethname
  • auto-document
:meth:`methname`
  • reference
.. attribute:: attrname property definition
.. autoattribute:: attrname
  • auto-document
:attr:`attrname`
  • reference
.. application:: appname application definition
.. autoapplication:: appname
  • auto-document
:app:`appname`
  • reference

Several options are available for auto-directives.

  • :members: auto-document public members
  • :show-inheritance: list bases
  • :undoc-members: document members without docstrings
  • :annotation: specifies attribute annotation instead of default

There are also several config values that can be set in conf.py that will affect auto-docementation.

  • autoclass_content can be set to class, both or init, which determines which docstring is used for classes. The constructor docstring is used when this is set to init.
  • autodoc_member_order can be set to alphabetical, groupwise or bysource.
  • autodoc_default_flags can be set to a list of options to apply. Use the no-flag directive option to disable this config value once.

Note

The module roles and directives create a psuedo namespace for MATLAB objects, similar to a package. They represent the path to the folder containing the MATLAB object. If no module is specified then Sphinx will assume that the object is a built-in.

Example: given the following MATLAB source in folder test_data:

classdef MyHandleClass < handle & my.super.Class
    % a handle class
    %
    % :param x: a variable

    %% some comments
    properties
        x % a property

        % Multiple lines before a
        % property can also be used
        y
    end
    methods
        function h = MyHandleClass(x)
            h.x = x
        end
        function x = get.x(obj)
        % how is this displayed?
            x = obj.x
        end
    end
    methods (Static)
        function w = my_static_function(z)
        % A static function in :class:`MyHandleClass`.
        %
        % :param z: input z
        % :returns: w

            w = z
        end
    end
end

Use the following to document:

Test Data
=========
This is the test data module.

.. automodule:: test_data

:mod:`test_data` is a really cool module.

My Handle Class
---------------
This is the handle class definition.

.. autoclass:: MyHandleClass
    :show-inheritance:
    :members:

Module Index

Since version 0.10.0 the MATLAB Module Index should be linked to with:

`MATLAB Module Index <mat-modindex.html>`_

Older versions, used the Python Module Index, which was linked to with:

:ref:`modindex`

Documenting Python and MATLAB sources together

Since version 0.10.0 MATLAB and Python sources can be (auto-)documented in the same Sphinx documentation. For this to work, do not set the primary domain.

Instead use the mat: prefix before the desired directives:

.. automodule:: func
.. autofunction:: func.main

.. mat:automodule:: matsrc
.. mat:autofunction:: matsrc.func

Online Demo

The test docs in the repository are online here: http://bwanamarko.alwaysdata.net/matlabdomain/

Note

Sphinx style markup are used to document parameters, types, returns and exceptions. There must be a blank comment line before and after the parameter descriptions. Currently property docstrings are only collected if they are on the same line following the property definition. Getter and setter methods are documented like methods currently, but the dot is replaced by an underscore. Default values for properties are represented as unicode strings, therefore strings will be double quoted.

Users

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].