I'm using sphinx to try and create HTML documents from .rst files. I'm attempting to create a document that has a numbered list (1., 2., ...) , with a nested sub-list (a., b, c., ...) that shows example code. But I'm having trouble teasing out the syntax to get the nested sub-list to work. Here's an example .rst
file of what I've tried:
===========
Tester Page
===========
Below are some test paragraphs.
1. This is a paragraph detailing a higher level step, with 3 sub-steps.
a. This is a sub-bullet, with an example:
::
ls -l foo.txt
b. I can't get this line to not display as part of the code block! This is another sub-bullet, with an example:
::
git add bar.txt
2. This is step 2.
This is the end of the document.
The above gives me a result similar to this (hard to reproduce exactly in Markdown, but hopefully you get the idea):
Tester Page
Below are some test paragraphs.
This is some text.
a. This is a sub-bullet, with an example:
ls -l foo.txt
b. This is another sub-bullet, with an example:
git add bar.txt
- This is step 2.
This is the end of the document.
I've been tweaking double-colons, white-space, and back-quotes for at least an hour, and can't figure out how to get it to format correctly. Perhaps reStructuredText is just not quite versatile enough to handle the nested list with embedded code blocks?
You have to be very careful with both vertical and horizontal whitespace. Nested lists must be separated from the parent list items by a blank line. Code examples in literal blocks must be indented properly.
Below are some test paragraphs.
1. This is a paragraph detailing a higher level step, with 3 sub-steps.
a. This is a sub-bullet, with an example::
ls -l foo.txt
b. I can get this line to display as part of the code block!
This is another sub-bullet, with an example::
git add bar.txt
2. This is step 2.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With