How to comment a string in restructured text?

prosseek picture prosseek · Jan 24, 2011 · Viewed 26.4k times · Source

The comment of HTML is <!-- .. -->, how can I make this comment block with restructured text? In order words, how can I comment out some of the lines in restructured text?

Answer

jball picture jball · Jan 24, 2011

From the reference:

Arbitrary indented text may follow the explicit markup start and will be processed as a comment element.

..
   _This: is a comment!

..
   [and] this!

..
   this:: too!

..
   |even| this:: !

It is also possible to put the comment on the same line as the double dots:

.. Avoid this type of comment

This is however considered bad practice since it may lead to unintended consequences if the comment matches a proper markup construct, as pointed out by @CecilCurry in the comment below.