Code snippets

Note

In the following examples the rendered output is followed by the markup that generated it.

Highlighting

inline code

``inline code``

Also commonly used for highlighting files, software etc



Callout boxes

Note

This is an example of a note box.

.. note::

   This is an example of a note box.

Attention

This is an example of a attention box.

.. attention::

   This is an example of a attention box.

Warning

This is an example of a warning box.

.. warning::

   This is an example of a warning box.

Caution

This is an example of a caution box.

.. caution::

   This is an example of a caution box.

Tip

This is an example of a tip box.

.. tip::

   This is an example of a tip box.

Important

This is an example of an important box.

.. important::

   This is an example of an important box.

Hint

This is an example of a hint box.

.. hint::

   This is an example of a hint box.

Error

This is an example of a error box.

.. error::

   This is an example of a error box.

Danger

This is an example of a danger box.

.. danger::

   This is an example of a danger box.

See also

This is an example of a see also box.

.. seealso::

   This is an example of a see also box.

This is an example of a general admonition.

You can make up your own admonitions too.

.. admonition:: This is an example of a general admonition.

    You can make up your own admonitions too.

This is an example of a general admonition with a custom colour.

You can make up your own admonitions with a custom colour scheme using defining a class and the CSS code to apply to it.

Here we use the class name “definition” to target and override the CSS via a raw HTML injection.

.. raw:: html

<style>
.admonition.definition {
    background: lightgreen;
}

.admonition.definition > .admonition-title {
    background-color: green;
}
</style>

.. admonition::  This is an example of a general admonition with a custom colour.
:class: definition

You can make up your own admonitions with a custom colour scheme using defining a class and the CSS code to apply to it.

Code blocks

This is a literal code block
::
    This is a literal code block

$ some code
.. code-block::

    $ some code

$some code
.. code-block:: sh

    $some code

$some code
.. code-block:: console

    $some code

 $some highlighted code
 some more code
.. code-block:: console
    :emphasize-lines:1

    $some highlighted code
    some more code

.. code-block:: <language>

    $some code

Current <languages> used in code-blocks in our docs are: bash, c++, console, html+jinja, jinja, matlab, none, pycon, python, rst, shell, TCL, text.

Grouped Tabs

The cluster tabs should be arranged from the most recent cluster to the oldest cluster.

$ srun --pty bash -i
$ srun --mem=8G --pty bash -i
.. tabs::

    .. group-tab:: Stanage

        .. code-block:: console

            $ srun --pty bash -i

    .. group-tab:: Bessemer

        .. code-block:: console

            $ srun --pty bash -i
.. tabs::

    .. group-tab:: Stanage

        .. code-block:: console

            $ srun --mem=8G --pty bash -i

    .. group-tab:: Bessemer

        .. code-block:: console

            $ srun --mem=8G --pty bash -i