Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent line wrapping in literals #9929

Merged
merged 1 commit into from Dec 4, 2021

Conversation

jakobandersen
Copy link
Contributor

Feature or Bugfix

  • Bugfix

Purpose

At

# more formatting in literal nodes
for token in self.words_and_spaces.findall(encoded):
if token.strip():
# protect literal text from line wrapping
self.body.append('<span class="pre">%s</span>' % token)
it is indicated that the pre class is preventing line wrapping. The CSS was added in 37bb9c2, but it doesn't include the line-wrap attribute.
In Docutils I found the CSS

/* do not wrap at hyphens and similar: */
.literal > span.pre { white-space: nowrap; }

This PR adds the same to pre in the basic Sphinx theme.

Relates

Fixes #9909.

Copy link
Member

@tk0miya tk0miya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -33,6 +33,7 @@ Bugs fixed
with Python 3.10
* #9878: mathjax: MathJax configuration is placed after loading MathJax itself
* #9857: Generated RFC links use outdated base url
* #9909: HTML, prevent line-wrapping in literal text.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to use : as a separator of the component and title:

Suggested change
* #9909: HTML, prevent line-wrapping in literal text.
* #9909: HTML: prevent line-wrapping in literal text.

@tk0miya tk0miya merged commit be73133 into sphinx-doc:4.x Dec 4, 2021
@jakobandersen jakobandersen deleted the pre_line_wrap branch December 4, 2021 14:48
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Do not break lines within :option: references
2 participants