Search code examples
pythonpython-sphinx

Sphinx (documentation tool): set tab width in output


How do you set tab width in HTML output of Sphinx code snippets highlighted by Pygments? By default it is the annoying 8, but I want 4. Did not find a word about this setting in Sphinx conf.py.


Solution

  • You will need to write a Sphinx Extension. Add your custom Lexer, and apply it with VisibleWhitespaceFilter.