Pseudo Prolog Syntax Highlighting

Jupyter Book comes with code block syntax highlighting for a broad collection of programming languages. Code blocks are introduced with a triple-backtick fence followed by the programming language name, i.e., ```languageID.

Outcome

?- append([example, code], [snippet], A).
A = [example, code, snippet].

Syntax

```prolog
?- append([example, code], [snippet], A).
A = [example, code, snippet].
```

While Prolog syntax highlighting is available out of the box, it fails in certain cases, e.g., when specifying clausal logic

married;bachelor:-man,adult

We fix such highlighting discrepancies by defining Pseudo Prolog (pProlog) syntax in the sphinx_prolog.pprolog Sphinx extension module.

See also

See the Jupyter Book documentation for more details about the code block syntax highlighting.

Setup

To enable the sphinx_prolog.pprolog extension module in your Jupyter Book, include its name in your _config.yml file under the sphinx.extra_extensions key

sphinx:
  extra_extensions:
    # Load sphinx-prolog <https://github.com/simply-logical/sphinx-prolog>
    - sphinx_prolog.pprolog

See also

See the Usage section of the sphinx-prolog Extension page for more details.

Usage

To use our Pseudo Prolog syntax highlighting, specify the pProlog language when defining your code boxes

Outcome

married;bachelor:-man,adult

Syntax

```pProlog
married;bachelor:-man,adult
```

See also

For more information about the Pseudo Prolog syntax highlighting module see its technical documentation.