Skip to content

Commit fa67dce

Browse files
committed
Add xmlrole documentation
1 parent 5d9e16d commit fa67dce

File tree

2 files changed

+53
-3
lines changed

2 files changed

+53
-3
lines changed

source/reference/eval.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
==============
2-
Eval Directive
3-
==============
1+
=========
2+
Eval Role
3+
=========
44

55
.. warning:: This extension is both **experimental** and potentially
66
slow.

source/reference/xmlrole.txt

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
========
2+
XML Role
3+
========
4+
5+
The docutils restructuredText parser does not support nesting roles
6+
or formatting markup. This makes it impossible to, for example, have a
7+
monospace-formatted ``ref`` link without making a sphinx extension
8+
providing each possible permutation of formatting.
9+
10+
The ``xml`` role in the ``xmlrole`` extension allows you to express
11+
formatting using XML. It accepts the following tags:
12+
13+
.. list-table::
14+
:header-rows: 1
15+
:widths: 10 25 100
16+
17+
* - Tag
18+
- Attributes
19+
- Description
20+
21+
* - ``em``
22+
-
23+
- Emphasize the contained text. Typically renders as italics.
24+
25+
* - ``mono``
26+
-
27+
- Render the contained text in a monospace font.
28+
29+
* - ``strong``
30+
-
31+
- Render the contained text in a bold font.
32+
33+
* - ``ref``
34+
- ``target=<ref>``
35+
- Create a link to the docutils reference indicated by ``target``.
36+
37+
* - ``link``
38+
- ``target=<url>``
39+
- Create a link to a URL indicated by ``target``.
40+
41+
For example:
42+
43+
.. code-block:: rst
44+
45+
:xml:`<mono><ref target="binary-bson-dumps"></ref></mono>`
46+
47+
:xml:`<strong>See: <link target="https://example.com">An Example Link</link></strong>`
48+
49+
50+
.. seealso:: `xmlrole.py <https://github.com/mongodb/docs-tools/blob/master/sphinxext/xmlrole.py>`__

0 commit comments

Comments
 (0)