mirror of
https://github.com/glitch-soc/mastodon.git
synced 2024-11-23 08:34:13 -05:00
better code blocks
This commit is contained in:
parent
76b4e7727b
commit
4936d05adc
@ -2,7 +2,37 @@ $no-columns-breakpoint: 600px;
|
||||
|
||||
code {
|
||||
font-family: $font-monospace, monospace;
|
||||
font-weight: 400;
|
||||
border-radius: 3px;
|
||||
padding: 0 0.4em;
|
||||
background: darken($ui-base-color, 8%);
|
||||
}
|
||||
|
||||
pre {
|
||||
background: darken($ui-base-color, 8%);
|
||||
border-radius: 3px;
|
||||
padding: 0.75em;
|
||||
counter-reset: line;
|
||||
overflow-x: scroll;
|
||||
}
|
||||
|
||||
pre code {
|
||||
counter-increment: line;
|
||||
padding: 0;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
pre code::before {
|
||||
font-size: 0.8em;
|
||||
color: darken($primary-text-color, 33%);
|
||||
content: counter(line);
|
||||
display: inline-block;
|
||||
border-right: 1px solid darken($primary-text-color, 33%);
|
||||
margin: -0.05em 0.7em -0.05em 0;
|
||||
padding: 0.05em 0.5em 0.05em 0;
|
||||
text-align: right;
|
||||
width: 1.2em;
|
||||
white-space: nowrap;
|
||||
direction: rtl;
|
||||
}
|
||||
|
||||
.form-container {
|
||||
|
@ -9,7 +9,7 @@ class AdvancedTextFormatter < TextFormatter
|
||||
|
||||
def block_code(code, _language)
|
||||
<<~HTML
|
||||
<pre><code>#{ERB::Util.h(code).gsub("\n", '<br/>')}</code></pre>
|
||||
<pre><code>#{ERB::Util.h(code.rstrip).gsub("\n", '</code></br><code>')}</code></pre>
|
||||
HTML
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user