style: multiline code blocks

This commit is contained in:
mappu 2015-11-08 11:35:07 +13:00
parent deea763923
commit 8a9b36d3db
2 changed files with 10 additions and 1 deletions

View File

@ -139,7 +139,11 @@ function text2html($sz) {
$btparts = explode('`', $base); $btparts = explode('`', $base);
if (count($btparts) > 1 && (count($btparts) % 2)) { if (count($btparts) > 1 && (count($btparts) % 2)) {
for ($i = 1, $e = count($btparts); $i < $e; $i += 2) { for ($i = 1, $e = count($btparts); $i < $e; $i += 2) {
$btparts[$i] = '<span class="code">'.$btparts[$i].'</span>'; $class = 'code';
if (strpos($btparts[$i], "\n") !== false) {
$class .= ' code-multiline';
}
$btparts[$i] = '<span class="'.$class.'">'.$btparts[$i].'</span>';
} }
} }

View File

@ -29,6 +29,11 @@ h1,h2,h3 {
font-family:Consolas,monospace; font-family:Consolas,monospace;
white-space:pre; white-space:pre;
} }
.code-multiline {
display:inline-block;
padding:8px;
border-radius:8px;
}
/* */ /* */