tb-order

The tb-order directive creates an ordering question. Authors can include optional prompt content before one bullet list. Authors write list items in the correct order. HTML presents the items in a shuffled order and lets students move them with native Up and Down buttons before checking the answer.

Synopsis

The general format of the tb-order directive is:

.. tb-order::
   :optional parameter: value

   + --- Optional prompt area ---
   |
   | question text and optional Sphinx content
   |
   + --- Ordered item list ---

   - first item in the correct order
   - second item in the correct order
   - third item in the correct order

Options

class

String or List. Optional. A CSS class to add to the directive. See Common options for details.

name

String. Optional. Sphinx reference name for this ordering question. See Common options for details.

Accessibility behavior

HTML uses native buttons for each reorder action. Each item has an Up button and a Down button. Buttons are disabled when an item cannot move farther in that direction. Result text uses a status region so assistive technology can announce feedback after checking.

Fallback behavior

HTML without JavaScript renders the prompt and a deterministic item order with movement buttons. Text and PDF-oriented builders render the prompt and items as an ordering question. Static output does not support interactive checking.

Examples

Example 1: Daily sequence

Source

.. tb-order::

   Put these events in order.

   - Wake up
   - Eat breakfast
   - Go to class

Rendered

Put these events in order.

  1. Eat breakfast

  2. Go to class

  3. Wake up

Example 2: C++ compilation stages

Source

.. tb-order::

   - Write source code
   - Preprocess source files
   - Compile translation units
   - Link object files
   - Run the executable

Rendered

  1. Compile translation units

  2. Link object files

  3. Preprocess source files

  4. Run the executable

  5. Write source code