I\'m editing the documentation for a project of mine using Sphinx, which in turn uses reStructuredText as markup language.
I have a simple table (as opposed to
While it appears that ReST doesn't actually support cell content alignment, you can actually use line-blocks within your cell to enforce preservation of whitespace to effectively pad your cell's content.
You'll have to use some of the unicode-whitespace characters (e.g. U+2001 - EM QUAD
) and have them preceded by a normal space character (U+0020
) i.e. U+0020U+2001Your String
to stop the ReST parser complaining about malformed tables and unterminated substitution references, etc.
+--------+---------+
| String | Num |
+========+=========+
| foo || 12.00| # second cell's content is actually |12.00
+--------+---------+
| bar || 3.01|
+--------+---------+
| baz || 4.99|
+--------+---------+
| moo || 15.99|
+--------+---------+
| quux || 33.49|
+--------+---------+
| foo || 20.00|
+--------+---------+
| bar || 100.00|
+--------+---------+
Tables like the above start to look a bit awkward and are awkward to maintain but the approach gets the job done. It also goes without saying, you'll need to both edit and generate UTF-8 output. While rst2html.py
treats this well, I'm not sure how sphinx
deals with this and if it can, whether the alignment remains when generating non-HTML documents.