sphinx_nervproject_theme/ui/code.less

188 lines
3.5 KiB
Text
Raw Permalink Normal View History

2020-06-19 23:39:59 +02:00
pre {
white-space: pre-wrap;
overflow-wrap: break-word;
}
2020-05-16 14:27:03 +02:00
.content {
2020-06-19 23:39:59 +02:00
td.linenos, td.code {
border: none;
padding: 0;
margin: 0;
> .highlight pre {
border: none;
}
}
2020-05-16 14:27:03 +02:00
code {
2020-06-19 23:39:59 +02:00
color: @CdTClr;
padding: 0.25rem 0.1rem;
2020-05-16 14:27:03 +02:00
margin: 0;
font-size: 0.85em;
2020-06-19 23:39:59 +02:00
background-color: @CdBgClr;
border-bottom: @CdBClr solid 0.2em;
2020-05-16 14:27:03 +02:00
a, a:visited {
2020-06-19 23:39:59 +02:00
color: @CdLClr;
2020-05-16 14:27:03 +02:00
&:hover {
2020-06-19 23:39:59 +02:00
color: @CdLHClr;
2020-05-16 14:27:03 +02:00
}
}
}
td.linenos pre, pre span.lineno {
border-right: solid 0.3em @CdLnBClr;
background-color: @CdLnBgClr;
box-decoration-break: clone;
-webkit-box-decoration-break: clone;
color: @CdLnTClr;
2020-06-19 23:39:59 +02:00
white-space: pre;
overflow-wrap: normal;
margin: 0;
}
pre span.lineno {
float: left;
margin: 0 0.5rem 0 -0.5rem;
padding-left: 0.5rem;
box-decoration-break: clone;
-webkit-box-decoration-break: clone;
2020-06-19 23:39:59 +02:00
}
2020-05-16 14:27:03 +02:00
pre, pre[class*="language-"] {
line-height: 1.4;
padding: 1.25rem 1.5rem 1.25rem 0.5rem;
2020-05-16 14:27:03 +02:00
margin: 0.85rem 0;
2020-06-19 23:39:59 +02:00
background-color: @PrBgClr;
color: @PrTClr;
border-left: @PrBClr solid 0.5em;
box-decoration-break: clone;
-webkit-box-decoration-break: clone;
2020-05-16 14:27:03 +02:00
code {
2020-06-19 23:39:59 +02:00
color: @PrTClr;
2020-05-16 14:27:03 +02:00
padding: 0;
background-color: transparent;
}
a, a:visited {
2020-06-19 23:39:59 +02:00
color: @PrLClr;
2020-05-16 14:27:03 +02:00
&:hover {
2020-06-19 23:39:59 +02:00
color: @PrLHClr;
2020-05-16 14:27:03 +02:00
}
}
}
}
div[class*="language-"] {
position: relative;
2020-06-19 23:39:59 +02:00
background-color: @CdBgClr;
box-decoration-break: clone;
-webkit-box-decoration-break: clone;
2020-05-16 14:27:03 +02:00
.highlight-lines {
padding-top: 1.3rem;
width: 100%;
line-height: 1.4;
.highlighted {
2020-06-19 23:39:59 +02:00
background-color: @CdBgAClr;
color: @CdAClr;
2020-05-16 14:27:03 +02:00
}
}
pre, pre[class*="language-"] {
background: transparent;
position: relative;
z-index: 1;
}
&::before {
z-index: 3;
font-size: 0.75rem;
2020-06-19 23:39:59 +02:00
color: @CdT2Clr;
2020-05-16 14:27:03 +02:00
}
&:not(.line-numbers-mode) {
.line-numbers-wrapper {
display: none;
}
}
&.line-numbers-mode {
.highlight-lines {
.highlighted {
position: relative;
&:before {
content: ' ';
z-index: 3;
display: block;
2020-06-19 23:39:59 +02:00
width: @lineNumbersWrapperWidth;
2020-05-16 14:27:03 +02:00
height: 100%;
2020-06-19 23:39:59 +02:00
background-color: @CdBgAClr;
color: @CdBgClr;
2020-05-16 14:27:03 +02:00
}
}
}
pre {
2020-06-19 23:39:59 +02:00
padding-left: @lineNumbersWrapperWidth;
2020-05-16 14:27:03 +02:00
vertical-align: middle;
}
.line-numbers-wrapper {
2020-06-19 23:39:59 +02:00
width: @lineNumbersWrapperWidth;
2020-05-16 14:27:03 +02:00
text-align: center;
2020-06-19 23:39:59 +02:00
color: @PrLNClr;
2020-05-16 14:27:03 +02:00
padding: 1.25rem 0;
line-height: 1.4;
.line-number {
position: relative;
z-index: 4;
font-size: 0.85em;
}
}
&::after {
content: '';
z-index: 2;
2020-06-19 23:39:59 +02:00
width: @lineNumbersWrapperWidth;
2020-05-16 14:27:03 +02:00
height: 100%;
2020-06-19 23:39:59 +02:00
border-left: 0.5rem solid @PrB2Clr;
background-color: @PrBgClr;
2020-05-16 14:27:03 +02:00
}
}
}
//for lang in js ts html md vue css sass scss less stylus go java c sh yaml rst rust zsh gdscript esc
// div{'[class~="language-' + lang + '"]'}
// &:before
// content ('' + lang)
div[class~="language-javascript"] {
&:before {
content: "js";
}
}
div[class~="language-typescript"] {
&:before {
content: "ts";
}
}
div[class~="language-markup"] {
&:before {
content: "html";
}
}
div[class~="language-markdown"] {
&:before {
content: "md";
}
}
div[class~="language-json"]:before {
content: "json";
}
div[class~="language-ruby"]:before {
content: "rb";
}
div[class~="language-python"]:before {
content: "py";
}
div[class~="language-bash"]:before {
content: "sh";
}