diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 17:25:40 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 17:25:40 +0000 |
commit | cf7da1843c45a4c2df7a749f7886a2d2ba0ee92a (patch) | |
tree | 18dcde1a8d1f5570a77cd0c361de3b490d02c789 /tests/roots/test-directive-code/dedent.rst | |
parent | Initial commit. (diff) | |
download | sphinx-cf7da1843c45a4c2df7a749f7886a2d2ba0ee92a.tar.xz sphinx-cf7da1843c45a4c2df7a749f7886a2d2ba0ee92a.zip |
Adding upstream version 7.2.6.upstream/7.2.6
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/roots/test-directive-code/dedent.rst')
-rw-r--r-- | tests/roots/test-directive-code/dedent.rst | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/tests/roots/test-directive-code/dedent.rst b/tests/roots/test-directive-code/dedent.rst new file mode 100644 index 0000000..66ac91c --- /dev/null +++ b/tests/roots/test-directive-code/dedent.rst @@ -0,0 +1,64 @@ +dedent option +------------- + +.. code-block:: + + First line + Second line + Third line + Fourth line + +ReST has no fixed indent and only a change in indentation is significant not the amount [1]_. +Thus, the following code inside the code block is not indent even it looks so with respect to the previous block. + +.. code-block:: + + First line + Second line + Third line + Fourth line + +Having an option "fixates" the indent to be 3 spaces, thus the code inside the code block is indented by 4 spaces. + +.. code-block:: + :class: dummy + + First line + Second line + Third line + Fourth line + +The code has 6 spaces indent, minus 4 spaces dedent should yield a 2 space indented code in the output. + +.. code-block:: + :dedent: 4 + + First line + Second line + Third line + Fourth line + +Dedenting by zero, should not strip any spaces and be a no-op. + +.. note:: + This can be used as an alternative to ``:class: dummy`` above, to fixate the ReST indentation of the block. + +.. code-block:: + :dedent: 0 + + First line + Second line + Third line + Fourth line + +Dedent without argument should autostrip common whitespace at the beginning. + +.. code-block:: + :dedent: + + First line + Second line + Third line + Fourth line + +.. [1] https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#indentation |