Skip to main content

Insert images into Sphinx documentation using inline code and stylo

Project description

Sphinx-Stylo

Project PyPI - License
Code Build Status
PyPi PyPI

It is extremely early stages for this extension. It is not likely to be robust

Sphinx-Stylo is an extension to the Sphinx documentation tool that allows you to insert dynamically generated images created using the Stylo python library. Images can be defined using the .. stylo-image:: directive inline in your rst source files.

.. stylo-image::
   :align: center
   :img-width: 1920
   :img-height: 1080
   :display-width: 75%

   from stylo.color import FillColor
   from stylo.shape import Circle
   from stylo.image import SimpleImage

   color = FillColor("ffff00)
   circle = Circle(fill=True)

   image = SimpleImage(circle, color)

Then when a sphinx build is run your code will be executed and an image with the given dimensions will be inserted into the final HTML page.

If you want the code included alongside the inserted image then add the :include-code: option to the list of options under the directive.

You must store your image in a variable called image for it to be picked up by the extension.

Getting Started

If you want to use this extension in your documentation then you first need to install the extension using pip.

$ pip install sphinx-stylo

Then you need to add the extension to your extensions = [] list in your project's conf.py

extensions = [
    ...
    "sphinx_stylo"
]

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-stylo-0.1.1.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

sphinx_stylo-0.1.1-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file sphinx-stylo-0.1.1.tar.gz.

File metadata

  • Download URL: sphinx-stylo-0.1.1.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

File hashes

Hashes for sphinx-stylo-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2c53983054468455e2b3c6b66332932f8349a71aebeda6211ad42c819e60a03f
MD5 0a778710f8f318c8dcdd6de7b293787a
BLAKE2b-256 a02b5219c6c27c4b4afbfb892c1037ee59fca60ac6b585bb8bca08736d7aa265

See more details on using hashes here.

File details

Details for the file sphinx_stylo-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: sphinx_stylo-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

File hashes

Hashes for sphinx_stylo-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dc9ef2ec95d30f08619f4b3264308fbf365bb2c8442de165c3eac0025800b7d4
MD5 318c9593fdca23bf8fe499c231a869d4
BLAKE2b-256 9cf7d3f7ae4a7d5ffd679acaf732cc93eec94fffcd4546e06ffcd705b2e7590c

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