User login

Format code blocks within bulletted lists with ReStructured Text (rst)

The trick is to use the double-colon (::) at the end of the text where you want to introduce the code block with a single colon, and then indent the code block four spaces while only indenting the regular text two spaces. Do this even though you want the non-code lines of text to visually appear at the same indent as the code block and the original introducing line of the bullet.

The following ReStructured Text (ReST) markup, typically put in a .rst file, for example:

Testing integration
-------------------

* Install the data site per README.rst; by default it has http://data.nichq.localhost/ for its local URL.
* Install the `community site <https://gitlab.com/nichq/nichq-community>`_ per its README.md; by default it has http://nichq-community.local for its local URL.
* If either of your sites has a different local URL, adjust the below accordingly.
* Edit the ``/etc/hosts`` of the data site virtual machine to add::

    192.168.42.2   nichq-community.local

  (check the IP address to use by running the command ``ping nichq-community.local`` on your host machine.)
* Edit the ``/vagrant/nichq_ilab/local_settings.py`` and set the following data in the "# OAuth2 Keys" section::

Will give you this:

The nicely formatted presentation of the above text

Or as i wrote in my commit message: Nail the formatting for code blocks within bullet lists.

Searched words: 
rst indent code bullet block

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Syntax highlight code surrounded by the {syntaxhighlighter SPEC}...{/syntaxhighlighter} tags, where SPEC is a Syntaxhighlighter options string or "class="OPTIONS" title="the title".
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.