Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.3k
Open
Labels
Description
Describe the bug
Consider this source using raw horizontal tabulation character ascii 09 (TAB char).
..code-block:: "23456781234567812345678123456781234567812345678" mystring = r"aababcabcdabcdebar"
(take into account the github markdown uses tab stops every 4 spaces, this was done in an editor using 8 spaces per tab).
Then the HTML will use spaces, not tabs in<pre>...</pre>.
<div><div><pre><span></span><span>"23456781234567812345678123456781234567812345678"</span><span>mystring</span> <span>=</span> <span>r</span><span>"a ab abc abcd abcde bar"</span></pre></div>This contains no tabulation characters. So copying-pasting does not allow to recover the original source code.
How to Reproduce
Use above inindex.rst and excutemake html.
Environment Information
Platform: darwin; (macOS-15.7.2-arm64-arm-64bit-Mach-O)Python version: 3.13.3 (v3.13.3:6280bb54784, Apr 8 2025, 10:47:54) [Clang 15.0.0 (clang-1500.3.9.4)])Python implementation: CPythonSphinx version: 8.3.0+/5d0ad1686Docutils version: 0.22.4b1.devJinja2 version: 3.1.6Pygments version: 2.19.1Sphinx extensions
Additional context
On the other hand,literalinclude preserves horizontal tab characters.
Originally fromthis comment.
I presume this is a well-known fact, which simply illustrates the utility of attachment of the true source code.