Skip to main content

MkDoxy → MkDocs + Doxygen = easy documentation generator with code snippets

Project description

MkDoxy

MkDoxy → MkDocs + Doxygen = easy documentation generator with code snippets

Warning Extension is in development and few features are not working properly. More information in Known issues section and Issues page.

MkDoxy is based on matusnovak/doxybook

This python tool is extension for MkDocs. Extension will take your programme source code and runs Doxygen. Then converts exported XML into markdown and create new folder with full generated documentation. Next usage is by snippets inside documentation markdown.

Online Demo and Demo Source

Basic-implementation

Features

  • Easy to use: just add mkdoxy to your mkdocs.yml and config path to your project src folder.
  • Code snippets: mkdoxy supports code snippets in your documentation. Just add ::: <project_name>.<command_name> to your markdown file and mkdoxy will generate code just in the place where you want it. Inspired from mkdocstrings.
  • Multiple projects: mkdoxy supports multiple projects. You can add multiple source folders and generate documentation for all of them. For example, you can generate documentation for your C++ project and your Python project like in this example.
  • Custom API documentation structure is allowed using Jinja2 templates. You can add your own templates and generate documentation in any structure you want.

Requirements

  • python 3.8 or newer → sudo apt install python3
  • Pip → sudo apt install python3-pip
  • Doxygen → sudo apt install doxygen
  • Git → sudo apt install git (optional)

Installation

Install using Python Pip: https://pypi.org/project/MkDoxy/

pip install mkdoxy

Or installation from source:

git clone https://github.com/JakubAndrysek/MkDoxy.git
cd mkdoxy
python setup.py install # for normal usage
pip install -e . # for development (source code changes are applied immediately)

Example usage

Set [PROJECT] according to your project names configured in mkdocs.yml.

1. Generate class with name `rb::MotorChangeBuilder`

```yaml
::: doxy.[PROJECT].Class
  name: rb::MotorChangeBuilder
  1. Generate method brake (MotorId id, uint16_t brakingPower) from class with name rb::MotorChangeBuilderA
::: doxy.[PROJECT].Class.Method
  name: rb::MotorChangeBuilder
  method: brake (MotorId id, uint16_t brakingPower)
  1. Generate function with name readUltra (bool async)
::: doxy.[PROJECT].Function
  name: readUltra (bool async)
  1. Generate code snippet from file RBCXLeds.cpp
::: doxy.[PROJECT].Code
  file: RBCXLeds.cpp
  start: 21
  end: 35

Mkdocs.yml configuration

Click to expand
plugins:
  - mkdoxy:
      projects:
        apiProject1: # name of project must be alphanumeric + numbers (without spaces)
          src-dirs: path/to/src/project1
          full-doc: True
          doxy-cfg:
            FILE_PATTERNS: "*.cpp *.h*"
            EXAMPLE_PATH: examples
            RECURSIVE: True
        apiProject2:
          src-dirs: path/to/src/project2
          full-doc: True
          template-dir: path/to/userDefined/templates # optional (default is mkdoxy/templates) - custom template will replace default template
          # Example of custom template: https://mkdoxy-demo.kubaandrysek.cz/esp/annotated/
          doxy-cfg:
            FILE_PATTERNS: "*.py"
            EXAMPLE_PATH: ""
            RECURSIVE: True
            OPTIMIZE_OUTPUT_JAVA: True
            JAVADOC_AUTOBRIEF: True
            EXTRACT_ALL: True
        predefinedProject3:
          src-dirs: path/to/src/project3
          full-doc: False
          doxy-cfg:
            PREDEFINED: __cplusplus # example there: https://github.com/kuba2k2/libretuya/blob/master/mkdocs.yml
            CASE_SENSE_NAMES: NO
...
nav:
  - Home: 'index.md'
  - API:
      - Project 1:
          - 'Links': 'apiProject1/links.md'
          - 'Classes':
              - 'Class List': 'apiProject1/annotated.md'
              - 'Class Index': 'apiProject1/classes.md'
              - 'Class Hierarchy': 'apiProject1/hierarchy.md'
              - 'Class Members': 'apiProject1/class_members.md'
              - 'Class Member Functions': 'apiProject1/class_member_functions.md'
              - 'Class Member Variables': 'apiProject1/class_member_variables.md'
              - 'Class Member Typedefs': 'apiProject1/class_member_typedefs.md'
              - 'Class Member Enumerations': 'apiProject1/class_member_enums.md'
          - 'Namespaces':
              - 'Namespace List': 'apiProject1/namespaces.md'
              - 'Namespace Members': 'apiProject1/namespace_members.md'
              - 'Namespace Member Functions': 'apiProject1/namespace_member_functions.md'
              - 'Namespace Member Variables': 'apiProject1/namespace_member_variables.md'
              - 'Namespace Member Typedefs': 'apiProject1/namespace_member_typedefs.md'
              - 'Namespace Member Enumerations': 'apiProject1/namespace_member_enums.md'
          - 'Functions': 'apiProject1/functions.md'
          - 'Variables': 'apiProject1/variables.md'
          - 'Macros': 'apiProject1/macros.md'
          - 'Files': 'apiProject1/files.md'
      - Project 2:
...

use_directory_urls: true # (optional) for better links without .html extension

Known issues

  1. Doxygen is not able to parse Python code.
    • Solution: Use OPTIMIZE_OUTPUT_JAVA: True and JAVADOC_AUTOBRIEF: True in doxy-cfg section of mkdocs.yml.
  2. Relative links from snippets are not working properly.
    • In some cases, relative links are not working properly.
    • For example link on test page - ClassList under Class rb::MotorChangeBuilder is not working.

Changes

License


MIT License

Copyright (c) 2021 Kuba Andrýsek

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

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

mkdoxy-1.0.5.tar.gz (31.2 kB view details)

Uploaded Source

Built Distribution

mkdoxy-1.0.5-py3-none-any.whl (36.4 kB view details)

Uploaded Python 3

File details

Details for the file mkdoxy-1.0.5.tar.gz.

File metadata

  • Download URL: mkdoxy-1.0.5.tar.gz
  • Upload date:
  • Size: 31.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.16

File hashes

Hashes for mkdoxy-1.0.5.tar.gz
Algorithm Hash digest
SHA256 4856c5055e34081df66534c2778768b23595a79968243979f5663f87f008181b
MD5 39a9112fe095cad600addd29f24598b3
BLAKE2b-256 071c2b28d6833ce8c4a085bd54f43d844fcf0a1cf1940123f38e1c4efd00c3eb

See more details on using hashes here.

File details

Details for the file mkdoxy-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: mkdoxy-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 36.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.16

File hashes

Hashes for mkdoxy-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 591b3371f062952a6da85420c289d52d2658bf893ecce002a224207210a71656
MD5 37c13df5b61d077b12ad8b8ff88f7feb
BLAKE2b-256 5fa132337106232803c0c560a8a654cbf019af0246810b8fd606a0f2746c7aaf

See more details on using hashes here.

Supported by

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