Sphinx AutoSaltSLS

https://img.shields.io/pypi/v/sphinxcontrib-autosaltsls.svg https://travis-ci.com/Tanoti/sphinxcontrib-autosaltsls.svg?branch=master Documentation Status Updates Python 3 https://img.shields.io/badge/code%20style-black-000000.svg

Sphinx AutoSaltSLS provides a way to automatically document Salt .sls files (e.g. states, pillar, reactors, etc) using simple directives in the comments blocks of those files.

A comment block is identified using a block start string (default is ‘###’) and contains all subsequent lines that start with a given comment character (default is ‘#’‘). The block ends when a new start string or a non-comment line is read. Directives can be given in the comment block to control how the lines are parsed.

Getting Started

The following steps will walk through how to add AutoSaltSLS to an existing Sphinx project. For instructions on how to set up a Sphinx project, see Sphinx’s documentation on Getting Started.


AutoSaltSLS can be installed through pip:

pip install sphinxcontrib-autosaltsls

Next, add and configure AutoSaltSLS in your Sphinx project’s conf.py.


autosaltsls_sources = {
    'states': {
        'title': 'States',
        'template_path': '_templates/autosaltsls/states',
    'pillar' : {
        'title': 'Pillar'

The documentation will be built into the location specified by autosaltsls_build_root (defaults to ‘.’)

To configure AutoAPI behaviour further, see the Configuration documentation.

Basic Setup

The absolute minimum setup is to set autosaltsls_sources as a list of directories under your salt fileset area (e.g. /srv/salt) and let the extension index the files it finds. Documentation pages will be created but, unless the sls files have had their document comment blocks enabled, they will say “No content”.

autosaltsls_sources = [

See Comment Block Format for more information on how to enable these.

To Do

  • Write proper tests


This project was based on the logic behind both readthedocs/sphinx-autoapi and Jakski/sphinxcontrib-autoyaml, so many thanks to those projects for getting me started.

[~ Dependencies scanned by PyUp.io ~ ]