Skip to content

Use white-space: pre-wrap for code formatting - #810

Merged
Girgias merged 3 commits into
php:masterfrom
TimWolla:white-space-pre-wrap
Aug 30, 2023
Merged

Girgias merged 3 commits into
php:masterfrom
TimWolla:white-space-pre-wrap

Conversation

@TimWolla

@TimWolla TimWolla commented Aug 29, 2023 •

Copy link
Copy Markdown
Member

Apparently code formatting is used for the entire user comments. Use white-space: pre-wrap to avoid horizontal scrolling of the plaintext description.

see 7d40388

Fixes php/doc-en#2724

Apparently code formatting is used for the entire user comments. Use
`white-space: pre-wrap` to avoid horizontal scrolling of the plaintext
description.


see 7d40388
@kamil-tekiela

Copy link
Copy Markdown
Member

Also worth pointing out that the notes now have extra newlines.

@kamil-tekiela

Copy link
Copy Markdown
Member

This is done on purpose. See #770

However, you are right that in user notes there could be normal text that should not be scrollable. I guess that's the reason why it was done using code span span selector before. I believe you need to also add this:

.phpcode code span span {
    white-space: pre;
}

@TimWolla

Copy link
Copy Markdown
Member Author

Also worth pointing out that the notes now have extra newlines.

Ugh. Are they stored in a pre-rendered version or is the post-processor just not applied to them? They also still have the  .

I believe you need to also add this:

You mean to prevent the wrapping from happening within the actual PHP code?

@TimWolla

Copy link
Copy Markdown
Member Author

or is the post-processor just not applied to them?

Answering my own question:

$text = highlight_php(trim($text), true);
.

I'll unify that function with PhD.

@TimWolla

Copy link
Copy Markdown
Member Author

You mean to prevent the wrapping from happening within the actual PHP code?

This doesn't actually work, because this doesn't match the whitespace within PHP code. I don't really consider soft wrapping the PHP code to be an issue, though. It shouldn't change the semantic.

I've added a commit to unify the highlighting with PhD, though. I've also verified that the PHP 8.0 release page renders properly.

@Girgias
Girgias merged commit 2a5e5a4 into php:master Aug 30, 2023
@TimWolla
TimWolla deleted the white-space-pre-wrap branch August 30, 2023 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

User provided comments on one line

3 participants