Skip to content

Commit

Permalink
Update documentation of :dedent: with note about leading space
Browse files Browse the repository at this point in the history
Include use case for :dedent: 0 and note that for a directive without
any option whitespace is stripped by the ReST parser.
  • Loading branch information
latosha-maltba committed Sep 21, 2021
1 parent 3b9ecf9 commit 7a9d721
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions doc/usage/restructuredtext/directives.rst
Original file line number Diff line number Diff line change
Expand Up @@ -598,10 +598,23 @@ __ https://pygments.org/docs/lexers
are removed via :func:`textwrap.dedent()`. For example::
.. code-block:: ruby
:linenos:
:dedent: 4
some ruby code
Using ``0`` as argument does not strip anything and can be used to
preserve leading whitespace in the code. Without any option to
a directive, leading whitespace would be treated as part of the indent of
the content of the directive and not as part of the content of the
literal block (:duref:`ref <indentation>`) and thus will not occur in the
output::
.. code-block:: ruby
:dedent: 0
some ruby code with 4 leading spaces in the output
.. versionadded:: 1.3
.. versionchanged:: 3.5
Support automatic dedent.
Expand Down

0 comments on commit 7a9d721

Please sign in to comment.