Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Thecode-block directive replaces all (raw) horizontal tabulation characters with spaces, hence the displayed code can differ from source, even ignoring highlighting #14065

Open
@jfbu

Description

@jfbu

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>&quot;23456781234567812345678123456781234567812345678&quot;</span><span>mystring</span> <span>=</span> <span>r</span><span>&quot;a       ab      abc     abcd    abcde   bar&quot;</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.1

Sphinx 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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp