Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

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.

Files for sphinx-stylo, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size sphinx_stylo-0.1.1-py3-none-any.whl (5.0 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size sphinx-stylo-0.1.1.tar.gz (3.6 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page