A Sphinx extension, which trims redundant blanks generated due to line breaks or inline-markups from generated documents.
Note
This extension is inspired by japansesupport.py. sphinxcontrib-trimblank is more friendly for ascii characters appearing in your document.
Use pip:
pip install sphinxcontrib-trimblankOnly add 'sphinxcontrib.trimblank' to extensions option in conf.py:
extensions += ['sphinxcontrib.trimblank']If you want to change the extension behaviour, configure options in conf.py:
# Keep blanks to adjacent to ascii characters in html documents
trimblank_keep_alnum_blank = ['html', 'singlehtml']All options are listed in Configuration.
| option name | meaning | default |
|---|---|---|
| trimblank_enabled | A list of builder names ('html', 'singlehtml', 'latex', and so on). Only when the builder in the list is used, sphinxcontrib-trimblank will trim blanks. The value may also be a boolean. Then the extension will do, or not do for any builder. | True |
| trimblank_keep_alnum_blank | A list of builder names ('html', 'singlehtml', 'latex', and so on). Only when the builder in the list is used, sphinxcontrib-trimblank will keep blanks adjacent to an ascii character. The value may also be a boolean. Then the extension will do, or not do for any builder. | False |
| trimblank_keep_blank_before | A regular expression pattern string to specified characters, which sphinxcontrib-trimblank will keep blanks just before. | '[\s(]' |
| trimblank_keep_blank_after | A regular expression pattern string to specified characters, which sphinxcontrib-trimblank will keep blanks just after. | '[\s),.:?]' |
| trimblank_debug | If this value is True, the trimmed texts are output as building messages. |
False |
MIT Licence