Search code examples
pythondocumentationpython-sphinxword-wrap

Word wrap in Sphinx autosummary-generated table


I use Sphinx to generate the docs for my project, with the extension autosummary. It generates a table with the names of my modules and their summary.

Here is an image of the result :

Table generated by autosummary

However, the lines are too long and we have to use the slider to read the whole description.

I would like to wrap the description text, to get rid of the slider bar. I have searched everywhere and found nothing.

I tried putting | xxxx or <br /> xxxx in my description but it did not work.

Thank you in advance !


Solution

  • Override the CSS on the table with your own styles. Specifically:

    .wy-table-responsive table td,
    .wy-table-responsive table th {
      white-space: normal;
    }
    

    should take care of most of the problems. Or use a theme that does not use scrolling tables in its styles.