0

I'm one of the maintainers of sqlfluff, and I'd like to replicate similar pattern and anti-pattern examples to the flake8 documentation here: https://www.flake8rules.com/rules/E101.html

At the moment the default styling for code-block sections in rst files doesn't show whitespace as explicit characters, which is normally great - but not very useful if the mixture of whitespace is what you want to show.

Is there a way in rst code-block sections to render whitespace similar to the render whitespace settings in common code editors (similar to this SO question)?

An ideal answer would be to do this natively, but I'm also open to potential options in extending sphinx (although it would be useful to have some pointers on how to do that), or other creative workarounds.

2
  • Sphinx uses Pygments for syntax highlighting, and it has so-called filters one of them being VisibleWhitespaceFilter that would most likely do what is needed here. But as far as I know, it's not possible to instruct Sphinx to activate such filters.
    – sinoroc
    Commented May 27, 2020 at 8:28
  • Maybe this can help with the filter: stackoverflow.com/q/11413203/407651
    – mzjn
    Commented May 30, 2020 at 16:00

0