Attention

Advance Notice: Bessemer will be retired at the end of the day on Friday 31st October 2025.

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

We have a public hpc-examples repository which we can utilise. See HPC Example Scripts for more guidance.

#!/bin/bash
#SBATCH --job-name=mpi-lmp-indent
#SBATCH --mail-user=a.person@sheffield.ac.uk
#SBATCH --mail-type=FAIL
#SBATCH --time=00:01:00
#SBATCH --mem=1G
#SBATCH --ntasks-per-node=4
#SBATCH --output=mpi-output-%j.log
#SBATCH --error=mpi-error-%j.log

module load LAMMPS/3Mar2020-intel-2020a-Python-3.8.2-kokkos
export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK
srun --export=ALL lmp -in in.indent
.. literalinclude:: /hpc-examples/test.sh
   :language: bash

We can also include a selection of lines from a script:

#SBATCH --mail-user=a.person@sheffield.ac.uk
#SBATCH --mail-type=FAIL
#SBATCH --time=00:01:00
#SBATCH --mem=1G
#SBATCH --ntasks-per-node=4
#SBATCH --output=mpi-output-%j.log
.. literalinclude:: /hpc-examples/test.sh
   :language: bash
   :lines: 3-8

We can also download individual files using the following command:

wget https://raw.githubusercontent.com/rcgsheffield/hpc-examples/refs/heads/main/test.sh

Where test.sh is the relative path to the file.


$ 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

Hover Tooltips

Hover tooltips are enabled by the sphinx_tippy extension. Currently the tooltip will show the first few lines after an internal target reference, such as text, titles, admonitions and tables, but will not show code-blocks or group tabs.