Skip to main content

Describe JSON document structures in sphinx

Project description

https://img.shields.io/pypi/v/sphinx-jsondomain.svg?maxAge=2592000 https://readthedocs.org/projects/sphinx-jsondomain/badge/?version=latest https://travis-ci.org/dave-shawley/sphinx-jsondomain.svg?branch=master

I was surprised that this didn’t already exist somewhere when I wanted to describe a JSON document outside of using sphinxcontrib-httpdomain to document one of my APIs. This extension simplifies describing structured JSON documents using a new Sphinx domain.

.. json:object:: Github User

   What Github's API thinks a user looks like.

   :property string login: the user's login
   :property integer id: Github assigned unique user identifier
   :property string avatar_url: url to user's selected avatar image
      or the empty string
   :property string gravatar_url: url to the user's gravatar image
      or the empty string

This will format to something pretty and make references to :json:object:`Github User` work as expected. See the online examples for a better idea of what is possible.

Quick Start

Install sphinx and the sphinx-jsondomain package:

$ python3 -mvenv env
$ env/bin/pip install -q sphinx sphinx-jsondomain

Set up the sphinx documentation root and build your documentation set:

$ env/bin/sphinx-quickstart -p my-project -r 0.0 -v 0.0.0 \
> -a 'Dave Shawley <daveshawley@gmail.com>' --quiet docs
$ env/bin/sphinx-build -b html docs build/sphinx/html

Now, find the extensions definition in docs/conf.py and add sphinxjsondomain to the end. Add a json:object directive to docs/index.rst and run sphinx-build again to see the results.

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

sphinx-jsondomain-0.0.3.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

sphinx_jsondomain-0.0.3-py2.py3-none-any.whl (9.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file sphinx-jsondomain-0.0.3.tar.gz.

File metadata

File hashes

Hashes for sphinx-jsondomain-0.0.3.tar.gz
Algorithm Hash digest
SHA256 fd4688d3026bd40c8d3aea94c0ea423d32dd9a046e6dc80fba83aaf60c87abc4
MD5 caff2b0eefce3f8689f2dcffd4988756
BLAKE2b-256 6c9c521e9703edfb28d370d51322797d63950d099dd934b9e3f6358299559dcc

See more details on using hashes here.

File details

Details for the file sphinx_jsondomain-0.0.3-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for sphinx_jsondomain-0.0.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 cdc03fa28dafc383d30451d724ea293dded4619d777acfa003b2a538bbf52f85
MD5 27a91f051f9a02fbb7c8872e7ae43c81
BLAKE2b-256 b0d584dd6832ba3efd05abadffed03c703cf592366c89580a12af893a3cde056

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