Skip to main content

A collection of Sphinx (and Jupyter Book) extensions for authoring interactive ProbLog code blocks.

Project description

Licence Python PyPI Documentation

:orange_book: ProbLog extension for Jupyter Book (and Sphinx)

This repository holds a ProbLog extensions for Sphinx, designed to be used with the Jupyter Book platform. It implements interactive ProbLog code blocks that can be executed directly in the browser via ProbLog API.

This readme file holds a technical documentation of the sphinx-problog extension. For a Jupyter Book usage example of interactive ProbLog code boxes visit the ProbLog template and its source hosted in the simply-logical/problog-book-template GitHub repository.

This readme file uses Jupyter Book's MyST Markdown syntax for roles and directives -- see MyST overview for more details. For use with Sphinx, please refer to the reStructuredText syntax.

:snake: Installing sphinx-problog

To get started with sphinx-problog, first install it via pip:

pip install sphinx-problog

then, add the problog module of the sphinx_problog extension to the Sphinx extensions list in your conf.py

...
extensions = ['sphinx_problog.problog']
...

:chart_with_upwards_trend: ProbLog directive

The sphinx_problog.problog module defines the problog directive, which is used for building interactive ProbLog code boxes executed directly in the browser.

Usage

A ProbLog code box is included with the problog directive:

```{problog} problog:1.2.3
optional :- content.
```

Each ProbLog code box can be referenced with its name using the ref role, e.g., {ref}`problog:1.2.3`, which produces ProbLog code box hyper-link.

Configuration parameters

The problog extension uses the following Sphinx configuration parameters:

Arguments, parameters and content

Each ProbLog code box has one required argument that specifies the unique id of this particular interactive code block. This id must start with the problog: prefix. The content of a ProbLog box can either be provided explicitly within the directive, or -- when the content is left empty -- it is pulled from a code file whose name is derived from the code box id, and which should be located in the directory specified via the sphinx_problog_code_directory configuration parameter. The code file name is expected to be the code block id without the problog: prefix and with the .pl extension. For example, for a code block with problog:my_code id, the code file should be named my_code.pl. The problog Sphinx extension monitors the code files for changes and automatically regenerates the affected pages.


The CSS and JS files used by this Sphinx extension (namely sphinx-problog.css, mode-problog.js and problog_editor_advanced.js, as well as their CDN-pulled dependencies ace.js, jquery.min.js, jquery-ui.min.js and md5.js) can be found in the sphinx_problog/_static directory of this repository.

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-problog-0.1.post4.tar.gz (112.8 kB view details)

Uploaded Source

Built Distribution

sphinx_problog-0.1.post4-py3-none-any.whl (112.8 kB view details)

Uploaded Python 3

File details

Details for the file sphinx-problog-0.1.post4.tar.gz.

File metadata

  • Download URL: sphinx-problog-0.1.post4.tar.gz
  • Upload date:
  • Size: 112.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for sphinx-problog-0.1.post4.tar.gz
Algorithm Hash digest
SHA256 4874f314552e1e6864f73c52008a878b8b892cc376dc2fbae0631647c5513f02
MD5 3d15a21d60ba551c14b7903cb8a81c60
BLAKE2b-256 2920ddd8eeba1c8666c1685dc73973970f9b354a2ef77d0668b7008881aa77e8

See more details on using hashes here.

File details

Details for the file sphinx_problog-0.1.post4-py3-none-any.whl.

File metadata

  • Download URL: sphinx_problog-0.1.post4-py3-none-any.whl
  • Upload date:
  • Size: 112.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for sphinx_problog-0.1.post4-py3-none-any.whl
Algorithm Hash digest
SHA256 1dfec02519dd6812a2a4ee4b27079b78faedb10b19e801e3793c9e90a1d0d4d7
MD5 6b10126c47f329991418909b66072a04
BLAKE2b-256 b00a5d85bfab5f5fa820e7a2a1cf020d7315aa524d83717cd4fe2969cff32e71

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