Consistent font size for code listings
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / style / bbcode / code.scss
CommitLineData
c947cf5f 1.redactor-layer pre {
97f8f467 2 background-color: rgb(255, 255, 255) !important;
8a52619a 3 box-shadow: 0 0 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
97f8f467
AE
4 border-radius: 2px;
5 color: rgb(68, 68, 68) !important;
cf12aedd 6 font-family: $wcfFontFamilyMonospace;
24f474f7 7 font-size: 14px;
97f8f467
AE
8 margin: 1em 0;
9 padding: 10px 20px;
10 position: relative;
2ef6247c
AE
11 white-space: pre-wrap;
12 word-break: break-all;
13 word-wrap: break-word;
8a52619a 14
3d9f265d
AE
15 &:not(.redactorCalcHeight)::before,
16 &.woltlabHtml::before {
333f26a7 17 color: $wcfContentLink;
97e54d27 18 content: attr(data-title);
7b83aa87 19 cursor: pointer;
97f8f467
AE
20 display: block;
21 font-family: $wcfFontFamily;
22 margin-bottom: 20px;
8a52619a 23
97f8f467
AE
24 @include wcfFontHeadline;
25 }
8a52619a 26
3d9f265d
AE
27 &.woltlabHtml {
28 &::before {
29 margin-bottom: 30px;
30 }
8a52619a 31
3d9f265d
AE
32 &::after {
33 color: $wcfContentDimmedText;
34 content: attr(data-description);
35 cursor: pointer;
36 display: block;
37 font-family: $wcfFontFamily;
38 position: absolute;
39 top: 32px;
8a52619a 40
3d9f265d
AE
41 @include wcfFontSmall;
42 }
43 }
97f8f467 44}
442a3ea1
AE
45
46.codeBox {
47 background-color: $wcfContentBackground;
8a52619a 48 box-shadow: 0 0 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
442a3ea1 49 border-radius: 2px;
9e8632c0 50 clear: both;
0663e9fb 51 margin: 1em 0;
442a3ea1 52 padding: 10px;
ce04ba92 53 position: relative;
8a52619a 54
ce04ba92 55 &.collapsed {
e587215c
TD
56 .codeBoxCode {
57 max-height: 200px;
58 overflow: hidden;
59 }
8a52619a 60
ce04ba92
AE
61 > .toggleButton {
62 bottom: 0;
ce04ba92
AE
63 left: 0;
64 padding-bottom: 10px;
65 position: absolute;
66 right: 0;
39eaca6d 67 z-index: 1;
8a52619a 68
c02d0e01 69 &::before {
8a52619a
TD
70 background-image: linear-gradient(
71 to top,
72 opacify($wcfContentBackground, 0.9),
73 transparentize($wcfContentBackground, 1)
74 );
c02d0e01
AE
75 content: "";
76 height: 60px;
77 left: 0;
78 pointer-events: none;
79 position: absolute;
80 right: 0;
81 top: -60px;
82 }
ce04ba92
AE
83 }
84 }
8a52619a 85
e587215c
TD
86 .codeBoxHeader {
87 position: sticky;
88 top: 50px;
89 z-index: 1;
90 padding: 10px 10px 10px;
91 margin: -10px -10px 0;
92 background-color: $wcfContentBackground;
8a52619a 93
e587215c
TD
94 align-items: center;
95 display: flex;
8a52619a 96
e587215c
TD
97 /* required to avoid layout jumping caused by the dynamically added 24px button */
98 min-height: 24px;
8a52619a 99
e587215c
TD
100 > .codeBoxHeadline {
101 flex: 1 1 auto;
102 padding: 0 10px;
8a52619a 103
e587215c 104 @include wcfFontHeadline;
c59d8cbe
AE
105
106 @include screen-sm-down {
107 overflow: auto;
108 white-space: nowrap;
109 }
110 }
111
112 .icon {
113 flex: 0 0 auto;
ce04ba92 114 }
e587215c 115 }
8a52619a 116
e587215c
TD
117 .codeBoxCode {
118 position: relative;
119 padding-left: 7ch;
8a52619a 120
e587215c
TD
121 > code {
122 display: block;
123 overflow-x: auto;
cf12aedd 124 font-family: $wcfFontFamilyMonospace;
24f474f7 125 font-size: 14px;
8a52619a 126
e587215c 127 .codeBoxLine {
1149a775 128 display: block;
8a52619a 129
e587215c
TD
130 > a {
131 margin-left: -7ch;
132 overflow: hidden;
133 position: absolute;
134 text-align: right;
135 text-overflow: ellipsis;
136 white-space: nowrap;
137 /* No one has line numbers greater than 999999 */
138 width: 6ch;
8a52619a 139
e587215c
TD
140 &::before {
141 content: attr(title);
070c42e0
TD
142 }
143 }
8a52619a 144
e587215c
TD
145 > span {
146 white-space: pre-wrap;
147 word-break: break-all;
148 }
8a52619a 149
e587215c
TD
150 &:target {
151 background-color: rgba(255, 255, 102, 1);
152 }
442a3ea1
AE
153 }
154 }
155 }
8a52619a 156
ce04ba92 157 > .toggleButton {
8a52619a 158 background-color: opacify($wcfContentBackground, 0.9);
ce04ba92
AE
159 cursor: pointer;
160 display: block;
161 padding: 10px 20px 0 10px;
162 text-align: center;
8a52619a 163
ce04ba92
AE
164 @include wcfFontSmall;
165 }
442a3ea1
AE
166}
167
e587215c
TD
168.anchorFixedHeader:not(.disableAnchorFixedHeader):target .codeBoxHeader {
169 top: -30px; /* see wsc31.scss */
170}
171
13a849f3
AE
172.dialogContent .codeBox .codeBoxHeader {
173 /* Prevent the header being sticky inside dialogs, which doesn't really work. */
174 position: static;
175}
176
070c42e0
TD
177/* PrismJS 1.15.0
178https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript&plugins=autoloader */
179/**
180 * prism.js default theme for JavaScript, CSS and HTML
181 * Based on dabblet (http://dabblet.com)
182 * @author Lea Verou
183 */
8a52619a
TD
184
185.token.comment,
186.token.prolog,
187.token.doctype,
188.token.cdata {
189 color: slategray;
190}
191
192.token.punctuation {
193 color: #999;
194}
195
196.namespace {
197 opacity: 0.7;
198}
199
200.token.property,
201.token.tag,
202.token.boolean,
203.token.number,
204.token.constant,
205.token.symbol,
206.token.deleted {
207 color: #905;
208}
209
210.token.selector,
211.token.attr-name,
212.token.string,
213.token.char,
214.token.builtin,
215.token.inserted {
216 color: #690;
217}
218
219.token.operator,
220.token.entity,
221.token.url,
222.language-css .token.string,
223.style .token.string {
224 color: #9a6e3a;
225 background: hsla(0, 0%, 100%, 0.5);
226}
227
228.token.atrule,
229.token.attr-value,
230.token.keyword {
231 color: #07a;
232}
233
234.token.function,
235.token.class-name {
236 color: #dd4a68;
237}
238
239.token.regex,
240.token.important,
241.token.variable {
242 color: #e90;
243}
244
245.token.important,
246.token.bold {
247 font-weight: 600;
248}
249.token.italic {
250 font-style: italic;
251}
252
253.token.entity {
254 cursor: help;
255}