0

I have a restructured text enumerated list, which I export to HTML with rst2html:

#. My first point
#. My second, very important point
#. My third, very important point
#. My fourth point

I would like to highlight the second and third point, which are clearly very important. This is easily done with:

#. My first point

.. class:: red

   #. My second, very important point
   #. My third, very important point
#. My fourth point

However, this restarts the numbering (i.e. the second and forth point will be 1), while I want to continue on. Is it possible?

I have considered the inline role :red:`important point syntax, but it doesn't fit my scenario (it's a very long list of red points, and I don't want to add the inline role to each line).

gozzilli
  • 8,089
  • 11
  • 56
  • 87

2 Answers2

1

This works for me:

#. My first point

   .. class:: red
#. My second, very important point

#. My third, very important point

#. My fourth point

You can't set a class for the first item that way, though.

Lennart Regebro
  • 167,292
  • 41
  • 224
  • 251
-1

What about adding a class to each of the important list items?

<li class="important">Important</li>

and then styling it appropriately?

You can also use the nth-child selector, if you know which item should be highlighted

li:nth-child(2) {
    color: red;
}
kmandov
  • 3,130
  • 16
  • 15
  • Sure, but how do I add a class to the `li` from the reST? – gozzilli Jan 14 '15 at 12:16
  • I can't think of other approach than adding the role for each of your important li elements. Like in this case: http://stackoverflow.com/questions/4669689/how-to-use-color-in-text-with-restructured-text-rst2html-py-or-how-to-insert-h/4669850#4669850 – kmandov Jan 14 '15 at 12:24
  • Yes, precisely. That's what I do at the moment (see last line of my question). I don't think there is a proper solution then. – gozzilli Jan 15 '15 at 10:28