sphinx_rtd_theme icon indicating copy to clipboard operation
sphinx_rtd_theme copied to clipboard

Do not break lines within :option: references

Open marxin opened this issue 4 years ago • 1 comments

Please cherry-pick the upstream change made in https://github.com/sphinx-doc/sphinx/pull/9929 that resolved https://github.com/sphinx-doc/sphinx/issues/9909.

marxin avatar Dec 08 '21 09:12 marxin

Thank you for reporting this @marxin.

The problem with white-space: nowrap is that it will break the layout for long .literals.

Screenshot 2021-12-08 134610

Maybe we can assume that users will choose to use a block literals for these cases, or we could make the .literal inline-block elements instead. This options requires more testing to make sure nothing breaks and some tweaking to paddings and positionings to make sure the inline-block elements don't shift the line height.

What do you think @agjohnson?

I did some initial testing and the code bellow works without any line shifting. We'd just need to test it for possible edge cases.

Screenshot 2021-12-08 140618

nienn avatar Dec 08 '21 14:12 nienn