Jason S
Jason S

Reputation: 189836

symbols in restructuredText

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.

Upvotes: 24

Views: 14935

Answers (4)

HyperActive
HyperActive

Reputation: 1326

I had a similar problem when making html from .rst files containing the ± character in Windows using Sphinx. Changing the file encoding from windows-1252 to UTF-8 fixed it for me.

Simply open with notepad, Save As..., and change Encoding: to UTF-8

Upvotes: 1

davidrmcharles
davidrmcharles

Reputation: 1953

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:`→`

Which renders like this:

This way →

Upvotes: 4

S.Lott
S.Lott

Reputation: 391962

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.

Upvotes: 21

Hank Gay
Hank Gay

Reputation: 71999

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

Upvotes: 5

Related Questions