use custom divs in rST

397 views
Skip to first unread message

cornelius

unread,
Oct 12, 2012, 12:54:01 PM10/12/12
to sphin...@googlegroups.com
Hi,

I think writing my own theme. I'd like to have some styles for paragraphs.

I saw that I can define a role,

.. role:: pleasenote
    :class: pleasenote

which will produce a html span with the class "pleasenote".

But i'd like to produce a div, to be able to define paragraphs and some kind of text boxes.

Any idea if this is possible?

Thanks a lot and kind regards
Cornelius

Jonathan Waltman

unread,
Oct 13, 2012, 4:34:00 AM10/13/12
to sphin...@googlegroups.com
On Fri, Oct 12, 2012 at 11:54 AM, cornelius
<corneliu...@lsexperts.de> wrote:
> Hi,
>
> I think writing my own theme. I'd like to have some styles for paragraphs.
>
> I saw that I can define a role,
>
> .. role:: pleasenote
> :class: pleasenote
>
> which will produce a html span with the class "pleasenote".
>
> But i'd like to produce a div, to be able to define paragraphs and some kind
> of text boxes.

Roles are usually for inline elements. I think what you are wanting
is a "directive" that you can put block level elements in.

The "container" directive[1] might do what you want. It produces a
div with a specified class.

.. container:: my-class

Nested paragraph 1.

Nested paragraph 2.


There are also some built-in directives with custom classes you could
use, like "note" and "warning". [2]

[1] http://docutils.sourceforge.net/docs/ref/rst/directives.html#container
[2] http://sphinx.pocoo.org/markup/para.html

--
Jonathan Waltman
Reply all
Reply to author
Forward
0 new messages