Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 6 additions & 18 deletions include/layout.inc
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,14 @@ function highlight_php($code, $return = false)
}

// Fix output to use CSS classes and wrap well
$highlighted = '<div class="phpcode">' . str_replace(
$highlighted = '<div class="phpcode">' . strtr(
$highlighted,
[
'&nbsp;',
'<br>',
'<span style="color: ',
'</font>',
"\n ",
' ',
' '
],
[
' ',
"<br>\n",
'<span class="',
'</span>',
"\n&nbsp;",
'&nbsp; ',
'&nbsp; '
'&nbsp;' => ' ',
"\n" => '',

'<span style="color: ' => '<span class="',
],
$highlighted
) . '</div>';

if ($return) { return $highlighted; }
Expand Down
18 changes: 3 additions & 15 deletions manual/add-note.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,7 @@
</div>
<div class="text">
<div class="phpcode">
<code>
<span class="html">
<p>eval() is the best for all sorts of things</p>
</span>
</code>
<code><span class="html">eval() is the best for all sorts of things</span></code>
</div>
</div>
</div>
Expand All @@ -220,11 +216,7 @@
</div>
<div class="text">
<div class="phpcode">
<code>
<span class="html">
<p>If eval() is the answer, you're almost certainly asking the wrong question.</p>
</span>
</code>
<code><span class="html">If eval() is the answer, you're almost certainly asking the wrong question.</span></code>
</div>
</div>
</div>
Expand All @@ -250,11 +242,7 @@
</div>
<div class="text">
<div class="phpcode">
<code>
<span class="html">
<p>egg bacon sausage spam spam baked beans</p>
</span>
</code>
<code><span class="html">egg bacon sausage spam spam baked beans</span></code>
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions styles/theme-base.css
Original file line number Diff line number Diff line change
Expand Up @@ -1325,10 +1325,10 @@ div.tip p:first-child {
margin-bottom: 1.5rem;
}

.docs .phpcode code {
.phpcode code {
display: block;
overflow-x: auto;
white-space: pre;
white-space: pre-wrap;
}

.docs .qandaentry dt .phpcode * {
Expand Down