Debian Codegraph @

tests/roots/test-directive-code/dedent.rst

raw
1 dedent option
2 -------------
3
4 .. code-block::
5
6 First line
7 Second line
8 Third line
9 Fourth line
10
11 ReST has no fixed indent and only a change in indentation is significant not the amount [1]_.
12 Thus, the following code inside the code block is not indent even it looks so with respect to the previous block.
13
14 .. code-block::
15
16 First line
17 Second line
18 Third line
19 Fourth line
20
21 Having an option "fixates" the indent to be 3 spaces, thus the code inside the code block is indented by 4 spaces.
22
23 .. code-block::
24 :class: dummy
25
26 First line
27 Second line
28 Third line
29 Fourth line
30
31 The code has 6 spaces indent, minus 4 spaces dedent should yield a 2 space indented code in the output.
32
33 .. code-block::
34 :dedent: 4
35
36 First line
37 Second line
38 Third line
39 Fourth line
40
41 Dedenting by zero, should not strip any spaces and be a no-op.
42
43 .. note::
44 This can be used as an alternative to ``:class: dummy`` above, to fixate the ReST indentation of the block.
45
46 .. code-block::
47 :dedent: 0
48
49 First line
50 Second line
51 Third line
52 Fourth line
53
54 Dedent without argument should autostrip common whitespace at the beginning.
55
56 .. code-block::
57 :dedent:
58
59 First line
60 Second line
61 Third line
62 Fourth line
63
64 .. [1] https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#indentation