sphinx_nervproject_theme/ui/code.less

171 lines
3 KiB
Text
Raw 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
}
}
}
2020-06-19 23:39:59 +02:00
td.linenos pre {
background-color: @CdBClr;
white-space: pre;
overflow-wrap: normal;
}
2020-05-16 14:27:03 +02:00
pre, pre[class*="language-"] {
line-height: 1.4;
padding: 1.25rem 1.5rem;
margin: 0.85rem 0;
2020-06-19 23:39:59 +02:00
background-color: @PrBgClr;
color: @PrTClr;
border-left: @PrBClr solid 0.5em;
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;
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";
}