I've gotten lost in an edge case of sorts. I'm working on a conversion of some old plaintext documentation to reST/Sphinx format, with the intent of outputting to a few formats (including HTML and text) from there. Some of the documented functions are for dealing with bitstrings, and a common case within these is a sentence like the following: Starting character is the blank " " which has the value 0.
I tried writing this as an inline literal the following ways: Starting character is the blank `` `` which has the value 0.
or Starting character is the blank :literal:` ` which has the value 0.
but there are a few problems with how these end up working:
- reST syntax objects to a whitespace immediately inside of the literal, and it doesn't get recognized.
- The above can be "fixed"--it looks correct in the HTML (
) and plaintext (
" "
) output--with a non-breaking space character inside the literal, but technically this is a lie in our case, and if a user copied this character, they wouldn't be copying what they expect. - The space can be wrapped in regular quotes, which allows the literal to be properly recognized, and while the output in HTML is probably fine (
" "
), in plaintext it ends up double-quoted as"" ""
. - In both 2/3 above, if the literal falls on the wrap boundary, the plaintext writer (which uses
textwrap
) will gladly wrap inside the literal and trim the space because it's at the start/end of the line.
I feel like I'm missing something; is there a good way to handle this?