[web-php] master: Properly handle whitespace in PHP examples
| From: | Christoph M. Becker | Date: | Wed, 04 Jan 2023 14:58:07 +0000 |
| Subject: | [web-php] master: Properly handle whitespace in PHP examples | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-30724@lists.php.net to get a copy of this message | ||
Author: Christoph M. Becker (cmb69)
Date: 2023-01-04T15:45:40+01:00
Commit: https://github.com/php/web-php/commit/b7bccc4049ef4b70810fa159796133019674bdf8
Raw diff: https://github.com/php/web-php/commit/b7bccc4049ef4b70810fa159796133019674bdf8.diff
Properly handle whitespace in PHP examples
PhD no longer renders NBSPs, but regular spaces instead[1]. To retain
the desired indentation, we set the CSS propery
white-space:pre.
However, we cannot do that for the .phpcode class directly, because
highlight_string() emits additional line breaks at the top and the
bottom of the examples, so we use a more specific selector to avoid
this "padding".
[1] <https://github.com/php/phd/commit/87f794bafe22631f9886adb37db0bdf0006da3dd>
Changed paths:
M styles/theme-base.css
Diff:
diff --git a/styles/theme-base.css b/styles/theme-base.css
index 0206a82c7..fcd84a53a 100644
--- a/styles/theme-base.css
+++ b/styles/theme-base.css
@@ -1324,6 +1324,10 @@ div.tip p:first-child {
font-weight: normal;
}
+.phpcode code span span {
+ white-space: pre;
+}
+
/* }}} */