sphinxnotes-any

Documentation Status Open Source License PyPI Package PyPI Package Downloads GitHub Repository

Introduction

The extension provides a domain which allows user creates directive and roles to descibe, reference and index arbitrary object in documentation. It is a bit like sphinx.application.Sphinx.add_object_type(), but more powerful.

Getting Started

Note

We assume you already have a Sphinx documentation, if not, see Getting Started with Sphinx.

First, downloading extension from PyPI:

$ pip install sphinxnotes-any

Then, add the extension name to extensions configuration item in your conf.py:

extensions = [
          # …
          'sphinxnotes.any',
          # …
          ]

Add the such a “cat” dict in your conf.py:

cat = {
    'schema': {
        'name': 'str, ref, uniq',
        'attrs': {
            'color': 'str, ref',
        },
        'content': 'str'
    },
    'templates': {
        'obj':"Hi there, human! I've got **{{ color }}** fur.",
        'header': '🐈 {{ name }}',
        'ref': '``🐈 {{ name }}``',
    }
}

And add it to the any_object_types confval:

any_object_types = {
   'cat': cat,
}

Then you can document a cat using the any:cat directive:

Source
.. any:cat:: mimi
   :color: black
Result
🐈 mimi

Hi there, human! I’ve got black fur.

And reference a the cat with any:cat:

Source
Hi :any:cat:`mimi`! I am here!
Result

Hi 🐈 mimi! I am here!

Please refer to Usage for more details.

Contents

The Sphinx Notes Project

The project is developed by Shengyu Zhang, as part of The Sphinx Notes Project.

The Sphinx Notes Project