Question

For a documentation project I want to give code examples as lists of bullet points. I convert the .rst files to HTML using Sphinx. This works fine, until I start using literal blocks in the list items. In the example below I would like to display the sentence "After executing the following code" on the same level as "Given an XML-file...". However it is automatically indented.

Example
--------

-   Given an XML-file note.xml, which contains:

    ::

        <note>
            <to>Tove</to>
            <from>Jani</from>
            <heading>Reminder</heading>
            <body>Don't forget me this weekend!</body>
        </note>

    After executing the following code:

    ::

        xml = loadxml ("<your path to file>/note.xml");
        parent = xpath(xml, "//note"); //get main node
        addsubnode (parent, "<comment>Comments are welcome.</comment>");

PS: never mind the code, it's a special language.

Was it helpful?

Solution

Found the solution, by accident. It turns out to be really simple, just leave the line behind the bullet mark blank:

Examples
--------

-   

    Given an XML-file note.xml, which contains:

    ::

        <note>
            <to>Tove</to>
            <from>Jani</from>
            <heading>Reminder</heading>
            <body>Don't forget me this weekend!</body>
        </note>

    After executing the following code:

    ::

        xml = loadxml ("<your path to file>/note.xml");
        parent = xpath(xml, "//note"); //get main node
        addsubnode (parent, "<comment>Comments are welcome.</comment>");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top