Fix: adapt to inline line numbering
This commit is contained in:
parent
cf9a89b07b
commit
a90025fcb3
10 changed files with 230 additions and 3 deletions
5
CHANGES
5
CHANGES
|
@ -2,6 +2,11 @@
|
||||||
Changes
|
Changes
|
||||||
=======
|
=======
|
||||||
|
|
||||||
|
1.2.0 (*2020-06-??*)
|
||||||
|
====================
|
||||||
|
|
||||||
|
- Compatibility with inline line numbering
|
||||||
|
|
||||||
1.1.2 (*2020-06-21*)
|
1.1.2 (*2020-06-21*)
|
||||||
====================
|
====================
|
||||||
|
|
||||||
|
|
179
code.less
Normal file
179
code.less
Normal file
|
@ -0,0 +1,179 @@
|
||||||
|
pre {
|
||||||
|
white-space: pre-wrap;
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
td.linenos, td.code {
|
||||||
|
border: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
> .highlight pre {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
code {
|
||||||
|
color: @CdTClr;
|
||||||
|
padding: 0.25rem 0.1rem;
|
||||||
|
margin: 0;
|
||||||
|
font-size: 0.85em;
|
||||||
|
background-color: @CdBgClr;
|
||||||
|
border-bottom: @CdBClr solid 0.2em;
|
||||||
|
a, a:visited {
|
||||||
|
color: @CdLClr;
|
||||||
|
&:hover {
|
||||||
|
color: @CdLHClr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
td.linenos pre, pre span.lineno {
|
||||||
|
border-right: solid 0.3em @CdLnBClr;
|
||||||
|
background-color: @CdLnBgClr;
|
||||||
|
color: @CdLnTClr;
|
||||||
|
white-space: pre;
|
||||||
|
overflow-wrap: normal;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre span.lineno {
|
||||||
|
float: left;
|
||||||
|
margin: 0 0.5rem 0 -0.5rem;
|
||||||
|
padding-left: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre, pre[class*="language-"] {
|
||||||
|
line-height: 1.4;
|
||||||
|
padding: 1.25rem 1.5rem 1.25rem 0.5rem;
|
||||||
|
margin: 0.85rem 0;
|
||||||
|
background-color: @PrBgClr;
|
||||||
|
color: @PrTClr;
|
||||||
|
border-left: @PrBClr solid 0.5em;
|
||||||
|
code {
|
||||||
|
color: @PrTClr;
|
||||||
|
padding: 0;
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
a, a:visited {
|
||||||
|
color: @PrLClr;
|
||||||
|
&:hover {
|
||||||
|
color: @PrLHClr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
div[class*="language-"] {
|
||||||
|
position: relative;
|
||||||
|
background-color: @CdBgClr;
|
||||||
|
.highlight-lines {
|
||||||
|
padding-top: 1.3rem;
|
||||||
|
width: 100%;
|
||||||
|
line-height: 1.4;
|
||||||
|
.highlighted {
|
||||||
|
background-color: @CdBgAClr;
|
||||||
|
color: @CdAClr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pre, pre[class*="language-"] {
|
||||||
|
background: transparent;
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
&::before {
|
||||||
|
z-index: 3;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
color: @CdT2Clr;
|
||||||
|
}
|
||||||
|
&:not(.line-numbers-mode) {
|
||||||
|
.line-numbers-wrapper {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.line-numbers-mode {
|
||||||
|
.highlight-lines {
|
||||||
|
.highlighted {
|
||||||
|
position: relative;
|
||||||
|
&:before {
|
||||||
|
content: ' ';
|
||||||
|
z-index: 3;
|
||||||
|
display: block;
|
||||||
|
width: @lineNumbersWrapperWidth;
|
||||||
|
height: 100%;
|
||||||
|
background-color: @CdBgAClr;
|
||||||
|
color: @CdBgClr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pre {
|
||||||
|
padding-left: @lineNumbersWrapperWidth;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
.line-numbers-wrapper {
|
||||||
|
width: @lineNumbersWrapperWidth;
|
||||||
|
text-align: center;
|
||||||
|
color: @PrLNClr;
|
||||||
|
padding: 1.25rem 0;
|
||||||
|
line-height: 1.4;
|
||||||
|
.line-number {
|
||||||
|
position: relative;
|
||||||
|
z-index: 4;
|
||||||
|
font-size: 0.85em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&::after {
|
||||||
|
content: '';
|
||||||
|
z-index: 2;
|
||||||
|
width: @lineNumbersWrapperWidth;
|
||||||
|
height: 100%;
|
||||||
|
border-left: 0.5rem solid @PrB2Clr;
|
||||||
|
background-color: @PrBgClr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//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";
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "sphinx_nervproject_theme",
|
"name": "sphinx_nervproject_theme",
|
||||||
"version": "1.1.2",
|
"version": "1.2.0",
|
||||||
"description": "Sphinx Nerv Project Theme",
|
"description": "Sphinx Nerv Project Theme",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"directories": {
|
"directories": {
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -28,7 +28,7 @@ with open("README.rst", "r") as fh:
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="sphinx_nervproject_theme",
|
name="sphinx_nervproject_theme",
|
||||||
version="1.1.2",
|
version="1.2.0",
|
||||||
url="https://procrastinator.nerv-project.eu/nerv-project/communication/sphinx_nervproject_theme",
|
url="https://procrastinator.nerv-project.eu/nerv-project/communication/sphinx_nervproject_theme",
|
||||||
license="EUPL 1.2",
|
license="EUPL 1.2",
|
||||||
author="Kujiu",
|
author="Kujiu",
|
||||||
|
|
|
@ -6,7 +6,7 @@ from sphinx.environment.collectors import EnvironmentCollector
|
||||||
from sphinx import addnodes
|
from sphinx import addnodes
|
||||||
from sphinx.util.osutil import relative_uri
|
from sphinx.util.osutil import relative_uri
|
||||||
|
|
||||||
__version__ = (1, 1, 2)
|
__version__ = (1, 2, 0)
|
||||||
|
|
||||||
|
|
||||||
sys.setrecursionlimit(15000)
|
sys.setrecursionlimit(15000)
|
||||||
|
|
|
@ -36,6 +36,7 @@ Bh: ButtonHover
|
||||||
Bq: Blockquote
|
Bq: Blockquote
|
||||||
Btn: Button
|
Btn: Button
|
||||||
Cd: Code
|
Cd: Code
|
||||||
|
CdLn: Code line column
|
||||||
Fo: Footer
|
Fo: Footer
|
||||||
In: Input
|
In: Input
|
||||||
Pr: Pre
|
Pr: Pre
|
||||||
|
@ -156,6 +157,9 @@ Nv: Navbar
|
||||||
@baseCdT2Clr: hsla(211, 29%, 27%, 0.4);
|
@baseCdT2Clr: hsla(211, 29%, 27%, 0.4);
|
||||||
@baseCdLClr: @baseAaLClr;
|
@baseCdLClr: @baseAaLClr;
|
||||||
@baseCdLHClr: @baseAaLHClr;
|
@baseCdLHClr: @baseAaLHClr;
|
||||||
|
@baseCdLnTClr: @baseFoTClr;
|
||||||
|
@baseCdLnBClr: @baseFoBClr;
|
||||||
|
@baseCdLnBgClr: @baseFoBgClr;
|
||||||
|
|
||||||
|
|
||||||
@basePrAClr: @baseCdAClr;
|
@basePrAClr: @baseCdAClr;
|
||||||
|
@ -327,6 +331,9 @@ Nv: Navbar
|
||||||
@highContrastBaseCdT2Clr: hsla(206, 99%, 2%, 0.4);
|
@highContrastBaseCdT2Clr: hsla(206, 99%, 2%, 0.4);
|
||||||
@highContrastBaseCdLClr: @highContrastBaseAaLClr;
|
@highContrastBaseCdLClr: @highContrastBaseAaLClr;
|
||||||
@highContrastBaseCdLHClr: @highContrastBaseAaLHClr;
|
@highContrastBaseCdLHClr: @highContrastBaseAaLHClr;
|
||||||
|
@highContrastBaseCdLnTClr: @highContrastBaseFoTClr;
|
||||||
|
@highContrastBaseCdLnBClr: @highContrastBaseFoBClr;
|
||||||
|
@highContrastBaseCdLnBgClr: @highContrastBaseFoBgClr;
|
||||||
|
|
||||||
|
|
||||||
@highContrastBasePrAClr: @highContrastBaseCdAClr;
|
@highContrastBasePrAClr: @highContrastBaseCdAClr;
|
||||||
|
@ -497,6 +504,9 @@ Nv: Navbar
|
||||||
@darkBaseCdT2Clr: hsla(206, 99%, 90%, 0.4);
|
@darkBaseCdT2Clr: hsla(206, 99%, 90%, 0.4);
|
||||||
@darkBaseCdLClr: @darkBaseAaLClr;
|
@darkBaseCdLClr: @darkBaseAaLClr;
|
||||||
@darkBaseCdLHClr: @darkBaseAaLHClr;
|
@darkBaseCdLHClr: @darkBaseAaLHClr;
|
||||||
|
@darkBaseCdLnTClr: @darkBaseFoTClr;
|
||||||
|
@darkBaseCdLnBClr: @darkBaseFoBClr;
|
||||||
|
@darkBaseCdLnBgClr: @darkBaseFoBgClr;
|
||||||
|
|
||||||
@darkBasePrAClr: @darkBaseCdAClr;
|
@darkBasePrAClr: @darkBaseCdAClr;
|
||||||
@darkBasePrBgAClr: @darkBaseCdBgAClr;
|
@darkBasePrBgAClr: @darkBaseCdBgAClr;
|
||||||
|
@ -666,6 +676,9 @@ Nv: Navbar
|
||||||
@darkHighContrastBaseCdT2Clr: hsla(211, 29%, 98%, 0.4);
|
@darkHighContrastBaseCdT2Clr: hsla(211, 29%, 98%, 0.4);
|
||||||
@darkHighContrastBaseCdLClr: @darkHighContrastBaseAaLClr;
|
@darkHighContrastBaseCdLClr: @darkHighContrastBaseAaLClr;
|
||||||
@darkHighContrastBaseCdLHClr: @darkHighContrastBaseAaLHClr;
|
@darkHighContrastBaseCdLHClr: @darkHighContrastBaseAaLHClr;
|
||||||
|
@darkHighContrastBaseCdLnTClr: @darkHighContrastBaseFoTClr;
|
||||||
|
@darkHighContrastBaseCdLnBClr: @darkHighContrastBaseFoBClr;
|
||||||
|
@darkHighContrastBaseCdLnBgClr: @darkHighContrastBaseFoBgClr;
|
||||||
|
|
||||||
@darkHighContrastBasePrAClr: @darkHighContrastBaseCdAClr;
|
@darkHighContrastBasePrAClr: @darkHighContrastBaseCdAClr;
|
||||||
@darkHighContrastBasePrBgAClr: @darkHighContrastBaseCdBgAClr;
|
@darkHighContrastBasePrBgAClr: @darkHighContrastBaseCdBgAClr;
|
||||||
|
@ -836,6 +849,9 @@ Nv: Navbar
|
||||||
@printBaseCdT2Clr: @baseCdT2Clr;
|
@printBaseCdT2Clr: @baseCdT2Clr;
|
||||||
@printBaseCdLClr: @printBaseAaLClr;
|
@printBaseCdLClr: @printBaseAaLClr;
|
||||||
@printBaseCdLHClr: @printBaseAaLHClr;
|
@printBaseCdLHClr: @printBaseAaLHClr;
|
||||||
|
@printBaseCdLnTClr: @printBaseFoTClr;
|
||||||
|
@printBaseCdLnBClr: @printBaseFoBClr;
|
||||||
|
@printBaseCdLnBgClr: @printBaseFoBgClr;
|
||||||
|
|
||||||
|
|
||||||
@printBasePrAClr: @printBaseCdAClr;
|
@printBasePrAClr: @printBaseCdAClr;
|
||||||
|
|
|
@ -11,6 +11,9 @@
|
||||||
.no-print {
|
.no-print {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
.no-columns {
|
||||||
|
column-span: all;
|
||||||
|
}
|
||||||
|
|
||||||
main.content {
|
main.content {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
|
@ -114,6 +114,9 @@
|
||||||
@CdTClr: @baseCdTClr;
|
@CdTClr: @baseCdTClr;
|
||||||
@CdLClr: @baseCdLClr;
|
@CdLClr: @baseCdLClr;
|
||||||
@CdLHClr: @baseCdLHClr;
|
@CdLHClr: @baseCdLHClr;
|
||||||
|
@CdLnTClr: @baseCdLnTClr;
|
||||||
|
@CdLnBClr: @baseCdLnBClr;
|
||||||
|
@CdLnBgClr: @baseCdLnBgClr;
|
||||||
|
|
||||||
|
|
||||||
@PrAClr: @basePrAClr;
|
@PrAClr: @basePrAClr;
|
||||||
|
|
|
@ -114,6 +114,9 @@
|
||||||
@CdTClr: @printBaseCdTClr;
|
@CdTClr: @printBaseCdTClr;
|
||||||
@CdLClr: @printBaseCdLClr;
|
@CdLClr: @printBaseCdLClr;
|
||||||
@CdLHClr: @printBaseCdLHClr;
|
@CdLHClr: @printBaseCdLHClr;
|
||||||
|
@CdLnTClr: @printBaseCdLnTClr;
|
||||||
|
@CdLnBClr: @printBaseCdLnBClr;
|
||||||
|
@CdLnBgClr: @printBaseCdLnBgClr;
|
||||||
|
|
||||||
|
|
||||||
@PrAClr: @printBasePrAClr;
|
@PrAClr: @printBasePrAClr;
|
||||||
|
|
|
@ -120,6 +120,9 @@
|
||||||
--CdTClr: @baseCdTClr;
|
--CdTClr: @baseCdTClr;
|
||||||
--CdLClr: @baseCdLClr;
|
--CdLClr: @baseCdLClr;
|
||||||
--CdLHClr: @baseCdLHClr;
|
--CdLHClr: @baseCdLHClr;
|
||||||
|
--CdLnTClr: @baseCdLnTClr;
|
||||||
|
--CdLnBClr: @baseCdLnBClr;
|
||||||
|
--CdLnBgClr: @baseCdLnBgClr;
|
||||||
|
|
||||||
|
|
||||||
--PrAClr: @basePrAClr;
|
--PrAClr: @basePrAClr;
|
||||||
|
@ -295,6 +298,9 @@
|
||||||
--CdTClr: @highContrastBaseCdTClr;
|
--CdTClr: @highContrastBaseCdTClr;
|
||||||
--CdLClr: @highContrastBaseCdLClr;
|
--CdLClr: @highContrastBaseCdLClr;
|
||||||
--CdLHClr: @highContrastBaseCdLHClr;
|
--CdLHClr: @highContrastBaseCdLHClr;
|
||||||
|
--CdLnTClr: @highContrastBaseCdLnTClr;
|
||||||
|
--CdLnBClr: @highContrastBaseCdLnBClr;
|
||||||
|
--CdLnBgClr: @highContrastBaseCdLnBgClr;
|
||||||
|
|
||||||
|
|
||||||
--PrAClr: @highContrastBasePrAClr;
|
--PrAClr: @highContrastBasePrAClr;
|
||||||
|
@ -471,6 +477,9 @@
|
||||||
--CdTClr: @darkBaseCdTClr;
|
--CdTClr: @darkBaseCdTClr;
|
||||||
--CdLClr: @darkBaseCdLClr;
|
--CdLClr: @darkBaseCdLClr;
|
||||||
--CdLHClr: @darkBaseCdLHClr;
|
--CdLHClr: @darkBaseCdLHClr;
|
||||||
|
--CdLnTClr: @darkBaseCdLnTClr;
|
||||||
|
--CdLnBClr: @darkBaseCdLnBClr;
|
||||||
|
--CdLnBgClr: @darkBaseCdLnBgClr;
|
||||||
|
|
||||||
|
|
||||||
--PrAClr: @darkBasePrAClr;
|
--PrAClr: @darkBasePrAClr;
|
||||||
|
@ -646,6 +655,9 @@
|
||||||
--CdTClr: @darkHighContrastBaseCdTClr;
|
--CdTClr: @darkHighContrastBaseCdTClr;
|
||||||
--CdLClr: @darkHighContrastBaseCdLClr;
|
--CdLClr: @darkHighContrastBaseCdLClr;
|
||||||
--CdLHClr: @darkHighContrastBaseCdLHClr;
|
--CdLHClr: @darkHighContrastBaseCdLHClr;
|
||||||
|
--CdLnTClr: @darkHighContrastBaseCdLnTClr;
|
||||||
|
--CdLnBClr: @darkHighContrastBaseCdLnBClr;
|
||||||
|
--CdLnBgClr: @darkHighContrastBaseCdLnBgClr;
|
||||||
|
|
||||||
|
|
||||||
--PrAClr: @darkHighContrastBasePrAClr;
|
--PrAClr: @darkHighContrastBasePrAClr;
|
||||||
|
@ -823,6 +835,9 @@
|
||||||
--CdTClr: @printBaseCdTClr !important;
|
--CdTClr: @printBaseCdTClr !important;
|
||||||
--CdLClr: @printBaseCdLClr !important;
|
--CdLClr: @printBaseCdLClr !important;
|
||||||
--CdLHClr: @printBaseCdLHClr !important;
|
--CdLHClr: @printBaseCdLHClr !important;
|
||||||
|
--CdLnTClr: @printBaseCdLnTClr !important;
|
||||||
|
--CdLnBClr: @printBaseCdLnBClr !important;
|
||||||
|
--CdLnBgClr: @printBaseCdLnBgClr !important;
|
||||||
|
|
||||||
|
|
||||||
--PrAClr: @printBasePrAClr !important;
|
--PrAClr: @printBasePrAClr !important;
|
||||||
|
@ -1002,6 +1017,9 @@
|
||||||
@CdTClr: var(--CdTClr);
|
@CdTClr: var(--CdTClr);
|
||||||
@CdLClr: var(--CdLClr);
|
@CdLClr: var(--CdLClr);
|
||||||
@CdLHClr: var(--CdLHClr);
|
@CdLHClr: var(--CdLHClr);
|
||||||
|
@CdLnTClr: var(--CdLnTClr);
|
||||||
|
@CdLnBClr: var(--CdLnBClr);
|
||||||
|
@CdLnBgClr: var(--CdLnBgClr);
|
||||||
|
|
||||||
|
|
||||||
@PrAClr: var(--PrAClr);
|
@PrAClr: var(--PrAClr);
|
||||||
|
|
Loading…
Reference in a new issue