Is there a way to break a word across multiple lines in a table cell in reStructuredText so it appears as a single word in the output?

python-sphinx, restructuredtext

Solution

Ok, after some experimentation it looks like the usual backslash \ line continuation character works, i.e.

+---------------+---------------------------+
| key           | value                     |
+===============+===========================+
| short_word    | value_1                   |
+---------------+---------------------------+
| really_long\  | value 2                   |
| _word_I_want\ |                           |
| _to_break     |                           |
+---------------+---------------------------+

I found that I still had to move the underscore character to the next line otherwise the first line was still interpreted as a link target although the word in the resulting HTML table was written as a continuous word.

Problem

Say I have a table in `reStructuredText` like: ``` +---------------+---------------------------+ | key | value | +===============+===========================+ | short_word | value_1 | +---------------+---------------------------+ | really_long_ | value 2 | | word_I_want_ | | | to_break | | +---------------+---------------------------+ ``` Is there any way to break the word in the bottom left cell, i.e. with a line continuation escape character or anything like that so that it still appears as a single word in the output? In particular I'm using Sphinx to document my Python documentation and because of the trailing underscore character it's interpreting the first line as a link target which generates an error.

Original source

Related problems