Underline inline markup?

645 views
Skip to first unread message

Boris Kheyfets

unread,
Aug 20, 2012, 7:23:13 AM8/20/12
to sphin...@googlegroups.com
Is it somehow possible to have an underline inline markup? I know I can use :title: -- but it's somehow crooked way of getting things underlined.

Guenter Milde

unread,
Aug 23, 2012, 4:01:42 PM8/23/12
to sphin...@googlegroups.com
On 2012-08-20, Boris Kheyfets wrote:

> [-- Type: text/plain, Encoding: --]

> Is it somehow possible to have an underline inline markup? I know I can use
>:title: -- but it's somehow crooked way of getting things underlined.

Use a custom role and style it with CSS and/or in the LaTeX preamble.

See http://docutils.sourceforge.net/docs/ref/rst/directives.html#custom-interpreted-text-roles

Günter

Boris Kheyfets

unread,
Aug 27, 2012, 5:00:17 AM8/27/12
to sphin...@googlegroups.com, mi...@users.sf.net
Hello Gunter

I tried:

.. _doc:

.. role:: underlined(raw)
   :format: html
   :style: text-decoration: underline;

######
 Test
######

:underlined:`test` test text.

and this:

.. _doc:

.. role:: underlined(style="text-decoration: underline;")
   :format: html


######
 Test
######

:underlined:`test` test text.

but none works (both give errors). What do I do wrong?

Boris.

Guenter Milde

unread,
Aug 27, 2012, 9:34:51 AM8/27/12
to sphin...@googlegroups.com
On 2012-08-27, Boris Kheyfets wrote:

> [-- Type: text/plain, Encoding: quoted-printable --]

> Hello Gunter

> I tried:

> .. _doc:

> .. role:: underlined(raw)
> :format: html
> :style: text-decoration: underline;

This creates a role based on the raw role, i.e. it expects the content to be
raw html.

Instead, write

.. role:: underlined

and a CSS rule to style ``span.underlined`` in a custom style sheet.


Suggestions/patches improving
>> http://docutils.sourceforge.net/docs/ref/rst/directives.html#custom-interpreted-text-roles
to make this more clear are welcome.

Günter

Boris Kheyfets

unread,
Aug 28, 2012, 4:48:00 AM8/28/12
to sphin...@googlegroups.com
It works!

I've added

span.underlined {
    text-decoration: underline;
}

to default.css

and

.. role:: underlined

:underlined:`test underlined`

to the test.rst and it is underlined!

Thank You!
Reply all
Reply to author
Forward
0 new messages