Skip to content

Use C with sphinx.ext.autodoc

License

Unlicense, MIT licenses found

Licenses found

Unlicense
UNLICENSE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

speedyleion/sphinx-c-autodoc

Repository files navigation

sphinx-c-autodoc

Build Status Coverage Code Style Documentation Status

Dual-licensed under MIT or the UNLICENSE.

A basic attempt at extending Sphinx and autodoc to work with C files.

The idea is to add support for similar directives that autodoc provides. i.e.

A function in my_c_file.c:

/**
 * A simple function that adds.
 *
 * @param a: The initial value
 * @param b: The value to add to `a`
 *
 * @returns The sum of `a` and `b`.
 *
 */
int my_adding_function(int a, int b) {
    return a + b;
    }

Could be referenced in documentation as:

.. autocfunction:: my_c_file.c::my_adding_function

With the resulting documentation output of:

int my_adding_function(int a, int b)

A simple function that adds.

Parameters:
  • a - The initial value
  • b - The value to add to a
Returns:

The sum of a and b

Requires

Similar Tools

  • hawkmoth a sphinx extension that which will document all of a C file. It supports being able to regex list files and have those files be documented.
  • breathe A doxygen output to sphinx tool.

Full Documentation

The complete documentation can be found at https://sphinx-c-autodoc.readthedocs.io/en/latest