Debian Codegraph @

extensions/SyntaxHighlight_GeSHi/modules/pygments.wrapper.less

raw
1 @import 'mediawiki.skin.variables.less';
2
3 .mw-highlight {
4 unicode-bidi: embed;
5
6 div& {
7 // Position absolutely positioned elements relative to this container.
8 position: relative;
9 // Create a block formatting context so that the code block's background and
10 // absolutely positioned elements inside it (line numbers, copy button)
11 // do not overlap floated elements outside of it (e.g. image thumbnails, infoboxes).
12 // See T126010, T272853, T40932#10211022.
13 display: flow-root;
14 // Move the margin from the nested pre, as the block formatting context prevents margin collapsing
15 margin: 1em 0;
16 }
17
18 pre {
19 margin: 0;
20 /* Use a more commonly found tab size of 4 (e.g. as used in CodeEditor)
21 instead of the browser-default value of 8 */
22 -moz-tab-size: 4;
23 tab-size: 4;
24 }
25
26 /* Avoid displaying double borders for nested 'code' elements.
27 Before we started using the 'code' tag for inline code snippets,
28 <code><syntaxhighlight enclose=none ...>...</syntaxhighlight></code>
29 was a common pattern. Continue supporting it in existing content. */
30 code code& {
31 background-color: transparent;
32 color: inherit;
33 border: 0;
34 padding: 0;
35 }
36
37 /*
38 * Don't show a red border around syntax errors. This behavior may be useful
39 * in code editors, but it is not useful in a wiki environment, especially
40 * given the longstanding habit of using an existing, mostly-compatible lexer
41 * to highlight a language for which no lexer exists.
42 */
43 .err {
44 border: 0;
45 }
46
47 /* Highlight background of whole lines, not just text in them */
48 .hll {
49 display: block;
50 }
51
52 &-lines pre,
53 .content &-lines pre { // Increase specificty over mobile selectors
54
55 .mw-content-ltr& {
56 /* @noflip */
57 padding-left: 3.5em;
58 /* @noflip */
59 box-shadow: inset 2.75em 0 0 @background-color-neutral;
60
61 .hll {
62 /* @noflip */
63 margin-left: -3.5em;
64 /* @noflip */
65 padding-left: 3.5em;
66 }
67 }
68
69 /* stylelint-disable-next-line no-descending-specificity */
70 .mw-content-rtl& {
71 /* @noflip */
72 padding-right: 3.5em;
73 /* @noflip */
74 box-shadow: inset -2.75em 0 0 @background-color-neutral;
75
76 /* stylelint-disable-next-line no-descending-specificity */
77 .hll {
78 /* @noflip */
79 margin-right: -3.5em;
80 /* @noflip */
81 padding-right: 3.5em;
82 }
83 }
84 }
85
86 .linenos {
87 position: absolute;
88 box-sizing: border-box;
89 width: 2.75em;
90 background: none;
91 color: @color-placeholder;
92 white-space: pre;
93
94 .mw-content-ltr& {
95 /* @noflip */
96 left: 0;
97 /* @noflip */
98 text-align: right;
99 /* @noflip */
100 margin-right: 4px;
101 }
102
103 .mw-content-rtl& {
104 /* @noflip */
105 right: 0;
106 /* @noflip */
107 text-align: left;
108 /* @noflip */
109 margin-left: 4px;
110 }
111
112 &::before {
113 content: attr( data-line );
114 }
115 }
116
117 a:hover .linenos,
118 .hll a .linenos {
119 color: @color-base--hover;
120 }
121 }