|
| 1 | +############################################################ |
| 2 | +Accommodating wide content (tables, code blocks, and images) |
| 3 | +############################################################ |
| 4 | + |
| 5 | +Technotes use a narrow content column to improve readability. |
| 6 | +However, some content types need to more horizontal space. |
| 7 | +This page explains how to use the ``technote-wide-content`` CSS utility class to let content span the full width of the page. |
| 8 | + |
| 9 | +Tables and code blocks |
| 10 | +====================== |
| 11 | + |
| 12 | +To allow a table or code block to span the available horizontal space on a page, you can preceed it with the ``technote-wide-content`` class in a ``rst-class`` directive. |
| 13 | +The ``rst-class`` directive is not part of the table or code-block's directive, but is a separate preceeding directive that applies the ``technote-wide-content`` class to the following content. |
| 14 | + |
| 15 | +Tables |
| 16 | +------ |
| 17 | + |
| 18 | +.. tab-set:: |
| 19 | + |
| 20 | + .. tab-item:: reStructuredText |
| 21 | + :sync: rst |
| 22 | + |
| 23 | + .. code-block:: rst |
| 24 | +
|
| 25 | + .. rst-class:: technote-wide-content |
| 26 | +
|
| 27 | + +-----------------+-----------------+ |
| 28 | + | Header 1 | Header 2 | |
| 29 | + +=================+=================+ |
| 30 | + | Row 1, Column 1 | Row 1, Column 2 | |
| 31 | + +-----------------+-----------------+ |
| 32 | + | Row 2, Column 1 | Row 2, Column 2 | |
| 33 | + +-----------------+-----------------+ |
| 34 | +
|
| 35 | + .. tab-item:: markdown |
| 36 | + :sync: md |
| 37 | + |
| 38 | + .. code-block:: md |
| 39 | +
|
| 40 | + ```{rst-class} technote-wide-content |
| 41 | + ``` |
| 42 | +
|
| 43 | + | Header 1 | Header 2 | |
| 44 | + | --------------- | --------------- | |
| 45 | + | Row 1, Column 1 | Row 1, Column 2 | |
| 46 | + | Row 2, Column 1 | Row 2, Column 2 | |
| 47 | +
|
| 48 | +List tables |
| 49 | +----------- |
| 50 | + |
| 51 | +.. tab-set:: |
| 52 | + |
| 53 | + .. tab-item:: reStructuredText |
| 54 | + :sync: rst |
| 55 | + |
| 56 | + .. code-block:: rst |
| 57 | +
|
| 58 | + .. rst-class:: technote-wide-content |
| 59 | +
|
| 60 | + .. list-table:: |
| 61 | + :header-rows: 1 |
| 62 | +
|
| 63 | + * - Header 1 |
| 64 | + - Header 2 |
| 65 | + * - Row 1, Column 1 |
| 66 | + - Row 1, Column 2 |
| 67 | + * - Row 2, Column 1 |
| 68 | + - Row 2, Column 2 |
| 69 | +
|
| 70 | + .. tab-item:: markdown |
| 71 | + |
| 72 | + .. code-block:: md |
| 73 | +
|
| 74 | + ```{rst-class} technote-wide-content |
| 75 | + ``` |
| 76 | +
|
| 77 | + ```{list-table} |
| 78 | + :header-rows: 1 |
| 79 | +
|
| 80 | + * - Header 1 |
| 81 | + - Header 2 |
| 82 | + * - Row 1, Column 1 |
| 83 | + - Row 1, Column 2 |
| 84 | + * - Row 2, Column 1 |
| 85 | + - Row 2, Column 2 |
| 86 | + ``` |
| 87 | +
|
| 88 | +Code blocks |
| 89 | +----------- |
| 90 | + |
| 91 | +.. tab-set:: |
| 92 | + |
| 93 | + .. tab-item:: reStructuredText |
| 94 | + :sync: rst |
| 95 | + |
| 96 | + .. code-block:: rst |
| 97 | +
|
| 98 | + .. rst-class:: technote-wide-content |
| 99 | +
|
| 100 | + .. code-block:: python |
| 101 | +
|
| 102 | + def my_function(): |
| 103 | + return "Hello, world!" |
| 104 | +
|
| 105 | + .. tab-item:: markdown |
| 106 | + :sync: md |
| 107 | + |
| 108 | + .. code-block:: md |
| 109 | +
|
| 110 | + ```{rst-class} technote-wide-content |
| 111 | + ``` |
| 112 | +
|
| 113 | + ```python |
| 114 | + def my_function(): |
| 115 | + return "Hello, world!" |
| 116 | + ``` |
| 117 | +
|
| 118 | +Images and figures |
| 119 | +================== |
| 120 | + |
| 121 | +In technotes, plots and images should be presented with the ``figure`` directive so that they can be captioned and referenced. |
| 122 | +Figures support a ``figclass`` option that is compatible with the ``technote-wide-content`` class, which lets you avoid using a separate ``rst-class`` directive. |
| 123 | + |
| 124 | +.. tab-set:: |
| 125 | + |
| 126 | + .. tab-item:: reStructuredText |
| 127 | + :sync: rst |
| 128 | + |
| 129 | + .. code-block:: rst |
| 130 | +
|
| 131 | + .. figure:: my-plot.png |
| 132 | + :figclass: technote-wide-content |
| 133 | +
|
| 134 | + My plot. |
| 135 | +
|
| 136 | + .. tab-item:: markdown |
| 137 | + :sync: md |
| 138 | + |
| 139 | + .. code-block:: md |
| 140 | +
|
| 141 | + ```{figure} my-plot.png |
| 142 | + :figclass: technote-wide-content |
| 143 | +
|
| 144 | + My plot. |
| 145 | + ``` |
0 commit comments