Question

I want to use some symbols in restructuredText; how can I do this? (e.g. → in Markdown yields the "→" symbol as defined in the list of standard HTML character entities -- see also w3c reference)

Note: I don't want to require math formula support as a dependency.

Was it helpful?

Solution

You have a large number of defined symbols via the "substitution" operator.

You have to include the definitions via .. include:: <isonum.txt> or something similar.

Most of them have the form |larr| or |rarr|.

They are defined in the docutils.parsers.rst.include installation directory. There are dozens of files which define numerous Unicode characters.

OTHER TIPS

It was my impression that rst supported Unicode; can you just type in the raw character and let docutils handle encoding for HTML?

I think you were looking for this: http://docutils.sourceforge.net/docs/ref/rst/roles.html#raw

You can define the following role:

.. role::  raw-html(raw)
    :format: html

And then you can write:

This way :raw-html:`&rarr;`

Which renders like this:

This way →

Since rST definitely supports unicode (see the NoTex rST editor) you can just enter the symbol directly; in an example of NoTex you'll discover something like this:

|7Li+p → 2·4He| replace:: :sup:`7`\ Li + p → 2 :sup:`4`\ He

You see the arrow an the right hand side of the substitution? I hope this answers you question.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top