-
Notifications
You must be signed in to change notification settings - Fork 296
/
_code.sass
133 lines (109 loc) · 3.1 KB
/
_code.sass
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
// Inline code
code.literal, .sig-inline
background: var(--color-inline-code-background)
border-radius: 0.2em
// Make the font smaller, and use padding to recover.
font-size: var(--font-size--small--2)
padding: 0.1em 0.2em
p &
border: 1px solid var(--color-background-border)
.sig-inline
font-family: var(--font-stack--monospace)
// Code and Literal Blocks
$code-spacing-vertical: 0.625rem
$code-spacing-horizontal: 0.875rem
// Wraps every literal block + line numbers.
div[class*=" highlight-"],
div[class^="highlight-"]
margin: 1em 0
display: flex
.table-wrapper
margin: 0
padding: 0
pre
margin: 0
padding: 0
overflow: auto
// Needed to have more specificity than pygments' "pre" selector. :(
article[role="main"] .highlight &
line-height: 1.5
&.literal-block,
.highlight &
font-size: var(--code-font-size)
padding: $code-spacing-vertical $code-spacing-horizontal
// Make it look like all the other blocks.
&.literal-block
margin-top: 1rem
margin-bottom: 1rem
border-radius: 0.2rem
background-color: var(--color-code-background)
color: var(--color-code-foreground)
// All code is always contained in this.
.highlight
width: 100%
border-radius: 0.2rem
// Make line numbers and prompts un-selectable.
.gp, span.linenos
user-select: none
pointer-events: none
// Expand the line-highlighting.
.hll
display: block
margin-left: -$code-spacing-horizontal
margin-right: -$code-spacing-horizontal
padding-left: $code-spacing-horizontal
padding-right: $code-spacing-horizontal
/* Make code block captions be nicely integrated */
.code-block-caption
display: flex
padding: $code-spacing-vertical $code-spacing-horizontal
border-radius: 0.25rem
border-bottom-left-radius: 0
border-bottom-right-radius: 0
font-weight: 300
border-bottom: 1px solid
background-color: var(--color-code-background)
color: var(--color-code-foreground)
border-color: var(--color-background-border)
+ div[class]
margin-top: 0
pre
border-top-left-radius: 0
border-top-right-radius: 0
// When `html_codeblock_linenos_style` is table.
.highlighttable
width: 100%
display: block
tbody
display: block
tr
display: flex
// Line numbers
td.linenos
background-color: var(--color-code-background)
color: var(--color-code-foreground)
padding: $code-spacing-vertical $code-spacing-horizontal
padding-right: 0
border-top-left-radius: 0.2rem
border-bottom-left-radius: 0.2rem
.linenodiv
padding-right: $code-spacing-horizontal
font-size: var(--code-font-size)
box-shadow: -0.0625rem 0 var(--color-foreground-border) inset
// Actual code
td.code
padding: 0
display: block
flex: 1
overflow: hidden
.highlight
border-top-left-radius: 0
border-bottom-left-radius: 0
// When `html_codeblock_linenos_style` is inline.
.highlight
span.linenos
display: inline-block
padding-left: 0
padding-right: $code-spacing-horizontal
margin-right: $code-spacing-horizontal
box-shadow: -0.0625rem 0 var(--color-foreground-border) inset