2024-09-29 11:25:48 +00:00
|
|
|
@import 'mediawiki.skin.variables.less';
|
|
|
|
|
2020-12-30 15:31:33 +00:00
|
|
|
.mw-highlight {
|
|
|
|
unicode-bidi: embed;
|
|
|
|
|
2024-10-09 15:55:27 +00:00
|
|
|
div& {
|
|
|
|
// Position absolutely positioned elements relative to this container.
|
|
|
|
position: relative;
|
|
|
|
// Create a block formatting context so that the code block's background and
|
|
|
|
// absolutely positioned elements inside it (line numbers, copy button)
|
|
|
|
// do not overlap floated elements outside of it (e.g. image thumbnails, infoboxes).
|
|
|
|
// See T126010, T272853, T40932#10211022.
|
|
|
|
display: flow-root;
|
|
|
|
// Move the margin from the nested pre, as the block formatting context prevents margin collapsing
|
|
|
|
margin: 1em 0;
|
|
|
|
}
|
|
|
|
|
2020-12-30 15:31:33 +00:00
|
|
|
pre {
|
2024-10-09 15:55:27 +00:00
|
|
|
margin: 0;
|
2020-12-30 15:31:33 +00:00
|
|
|
/* Use a more commonly found tab size of 4 (e.g. as used in CodeEditor)
|
|
|
|
instead of the browser-default value of 8 */
|
|
|
|
-moz-tab-size: 4;
|
|
|
|
tab-size: 4;
|
2024-04-17 15:49:48 +00:00
|
|
|
}
|
|
|
|
|
2020-12-30 15:31:33 +00:00
|
|
|
/* Avoid displaying double borders for nested 'code' elements.
|
|
|
|
Before we started using the 'code' tag for inline code snippets,
|
|
|
|
<code><syntaxhighlight enclose=none ...>...</syntaxhighlight></code>
|
|
|
|
was a common pattern. Continue supporting it in existing content. */
|
|
|
|
code code& {
|
|
|
|
background-color: transparent;
|
2024-04-17 15:49:48 +00:00
|
|
|
color: inherit;
|
2020-12-30 15:31:33 +00:00
|
|
|
border: 0;
|
|
|
|
padding: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Don't show a red border around syntax errors. This behavior may be useful
|
|
|
|
* in code editors, but it is not useful in a wiki environment, especially
|
|
|
|
* given the longstanding habit of using an existing, mostly-compatible lexer
|
|
|
|
* to highlight a language for which no lexer exists.
|
|
|
|
*/
|
|
|
|
.err {
|
|
|
|
border: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Highlight background of whole lines, not just text in them */
|
|
|
|
.hll {
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
|
2021-01-01 16:42:55 +00:00
|
|
|
&-lines pre,
|
|
|
|
.content &-lines pre { // Increase specificty over mobile selectors
|
2021-01-25 14:41:10 +00:00
|
|
|
|
2021-01-12 10:19:16 +00:00
|
|
|
.mw-content-ltr& {
|
|
|
|
/* @noflip */
|
2021-01-01 19:54:48 +00:00
|
|
|
padding-left: 3.5em;
|
2021-01-12 10:19:16 +00:00
|
|
|
/* @noflip */
|
2024-09-29 11:25:48 +00:00
|
|
|
box-shadow: inset 2.75em 0 0 @background-color-neutral;
|
2021-01-12 10:19:16 +00:00
|
|
|
|
|
|
|
.hll {
|
|
|
|
/* @noflip */
|
|
|
|
margin-left: -3.5em;
|
|
|
|
/* @noflip */
|
|
|
|
padding-left: 3.5em;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* stylelint-disable-next-line no-descending-specificity */
|
|
|
|
.mw-content-rtl& {
|
|
|
|
/* @noflip */
|
|
|
|
padding-right: 3.5em;
|
|
|
|
/* @noflip */
|
2024-09-29 11:25:48 +00:00
|
|
|
box-shadow: inset -2.75em 0 0 @background-color-neutral;
|
2021-01-12 10:19:16 +00:00
|
|
|
|
|
|
|
/* stylelint-disable-next-line no-descending-specificity */
|
|
|
|
.hll {
|
|
|
|
/* @noflip */
|
|
|
|
margin-right: -3.5em;
|
|
|
|
/* @noflip */
|
|
|
|
padding-right: 3.5em;
|
|
|
|
}
|
2021-01-01 19:54:48 +00:00
|
|
|
}
|
2020-12-30 20:57:24 +00:00
|
|
|
}
|
|
|
|
|
2020-12-30 15:05:34 +00:00
|
|
|
.linenos {
|
2020-12-30 20:57:24 +00:00
|
|
|
position: absolute;
|
|
|
|
box-sizing: border-box;
|
|
|
|
width: 2.75em;
|
|
|
|
background: none;
|
2024-09-29 11:25:48 +00:00
|
|
|
color: @color-placeholder;
|
2020-12-30 20:57:24 +00:00
|
|
|
white-space: pre;
|
2020-12-30 14:43:27 +00:00
|
|
|
|
2021-01-12 10:19:16 +00:00
|
|
|
.mw-content-ltr& {
|
|
|
|
/* @noflip */
|
|
|
|
left: 0;
|
|
|
|
/* @noflip */
|
|
|
|
text-align: right;
|
|
|
|
/* @noflip */
|
|
|
|
margin-right: 4px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.mw-content-rtl& {
|
|
|
|
/* @noflip */
|
|
|
|
right: 0;
|
|
|
|
/* @noflip */
|
|
|
|
text-align: left;
|
|
|
|
/* @noflip */
|
|
|
|
margin-left: 4px;
|
|
|
|
}
|
|
|
|
|
2023-03-29 23:00:39 +00:00
|
|
|
&::before {
|
2020-12-30 14:43:27 +00:00
|
|
|
content: attr( data-line );
|
|
|
|
}
|
2020-12-30 15:31:33 +00:00
|
|
|
}
|
|
|
|
|
2021-01-13 16:52:44 +00:00
|
|
|
a:hover .linenos,
|
|
|
|
.hll a .linenos {
|
2024-09-29 11:25:48 +00:00
|
|
|
color: @color-base--hover;
|
2021-01-10 12:40:20 +00:00
|
|
|
}
|
2020-12-30 15:31:33 +00:00
|
|
|
}
|