mirror of https://github.com/pwndbg/pwndbg.git
highlight python builtins in the docs (#2851)
parent
574e3125f0
commit
00bcf2bf5a
@ -1,77 +1,93 @@
|
||||
/*
|
||||
Recommended material css settings by mkdocstrings.
|
||||
Using the recommended material css settings by mkdocstrings
|
||||
https://mkdocstrings.github.io/python/usage/customization/#material
|
||||
causes some bugs in the theme, so I'm omitting it.
|
||||
*/
|
||||
|
||||
Indentation.
|
||||
div.doc-contents:not(.first) {
|
||||
padding-left: 25px;
|
||||
border-left: .05rem solid var(--md-typeset-table-color);
|
||||
}
|
||||
|
||||
Mark external links as such.
|
||||
a.external::after,
|
||||
a.autorefs-external::after {
|
||||
https://primer.style/octicons/arrow-up-right-24
|
||||
mask-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.25 15.5a.75.75 0 00.75-.75v-9a.75.75 0 00-.75-.75h-9a.75.75 0 000 1.5h7.19L6.22 16.72a.75.75 0 101.06 1.06L17.5 7.56v7.19c0 .414.336.75.75.75z"></path></svg>');
|
||||
-webkit-mask-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.25 15.5a.75.75 0 00.75-.75v-9a.75.75 0 00-.75-.75h-9a.75.75 0 000 1.5h7.19L6.22 16.72a.75.75 0 101.06 1.06L17.5 7.56v7.19c0 .414.336.75.75.75z"></path></svg>');
|
||||
content: ' ';
|
||||
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
position: relative;
|
||||
|
||||
height: 1em;
|
||||
width: 1em;
|
||||
background-color: currentColor;
|
||||
}
|
||||
|
||||
a.external:hover::after,
|
||||
a.autorefs-external:hover::after {
|
||||
background-color: var(--md-accent-fg-color);
|
||||
}
|
||||
|
||||
Tree-like output for backlinks.
|
||||
.doc-backlink-list {
|
||||
--tree-clr: var(--md-default-fg-color);
|
||||
--tree-font-size: 1rem;
|
||||
--tree-item-height: 1;
|
||||
--tree-offset: 1rem;
|
||||
--tree-thickness: 1px;
|
||||
--tree-style: solid;
|
||||
display: grid;
|
||||
list-style: none !important;
|
||||
}
|
||||
|
||||
.doc-backlink-list li > span:first-child {
|
||||
text-indent: .3rem;
|
||||
}
|
||||
.doc-backlink-list li {
|
||||
padding-inline-start: var(--tree-offset);
|
||||
border-left: var(--tree-thickness) var(--tree-style) var(--tree-clr);
|
||||
position: relative;
|
||||
margin-left: 0 !important;
|
||||
|
||||
&:last-child {
|
||||
border-color: transparent;
|
||||
}
|
||||
&::before{
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: calc(var(--tree-item-height) / 2 * -1 * var(--tree-font-size) + var(--tree-thickness));
|
||||
left: calc(var(--tree-thickness) * -1);
|
||||
width: calc(var(--tree-offset) + var(--tree-thickness) * 2);
|
||||
height: calc(var(--tree-item-height) * var(--tree-font-size));
|
||||
border-left: var(--tree-thickness) var(--tree-style) var(--tree-clr);
|
||||
border-bottom: var(--tree-thickness) var(--tree-style) var(--tree-clr);
|
||||
}
|
||||
&::after{
|
||||
content: '';
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
background-color: var(--tree-clr);
|
||||
top: calc(var(--tree-item-height) / 2 * 1rem);
|
||||
left: var(--tree-offset) ;
|
||||
translate: calc(var(--tree-thickness) * -1) calc(var(--tree-thickness) * -1);
|
||||
}
|
||||
/*
|
||||
Highlight python builtins since they get mangled by mkdocstrings.
|
||||
See https://github.com/mkdocstrings/mkdocstrings/issues/754.
|
||||
*/
|
||||
.language-python span.n span:is(
|
||||
[title$="str"],
|
||||
[title$="int"],
|
||||
[title$="RuntimeError"],
|
||||
[title$="float"],
|
||||
[title$="list"],
|
||||
[title$="tuple"],
|
||||
[title$="dict"],
|
||||
[title$="set"],
|
||||
[title$="bool"],
|
||||
[title$="TypeError"],
|
||||
[title$="NameError"],
|
||||
[title$="ValueError"],
|
||||
[title$="KeyError"],
|
||||
[title$="AttributeError"],
|
||||
[title$="IndexError"],
|
||||
[title$="SyntaxError"],
|
||||
[title$="ImportError"],
|
||||
[title$="True"],
|
||||
[title$="False"],
|
||||
[title$="None"],
|
||||
[title$="print"],
|
||||
[title$="len"],
|
||||
[title$="range"],
|
||||
[title$="input"],
|
||||
[title$="open"],
|
||||
[title$="type"],
|
||||
[title$="isinstance"],
|
||||
[title$="dir"],
|
||||
[title$="help"],
|
||||
[title$="abs"],
|
||||
[title$="all"],
|
||||
[title$="any"],
|
||||
[title$="ascii"],
|
||||
[title$="bin"],
|
||||
[title$="breakpoint"],
|
||||
[title$="bytearray"],
|
||||
[title$="bytes"],
|
||||
[title$="callable"],
|
||||
[title$="chr"],
|
||||
[title$="classmethod"],
|
||||
[title$="compile"],
|
||||
[title$="complex"],
|
||||
[title$="delattr"],
|
||||
[title$="divmod"],
|
||||
[title$="enumerate"],
|
||||
[title$="eval"],
|
||||
[title$="exec"],
|
||||
[title$="filter"],
|
||||
[title$="format"],
|
||||
[title$="frozenset"],
|
||||
[title$="getattr"],
|
||||
[title$="globals"],
|
||||
[title$="hasattr"],
|
||||
[title$="hash"],
|
||||
[title$="hex"],
|
||||
[title$="id"],
|
||||
[title$="iter"],
|
||||
[title$="locals"],
|
||||
[title$="map"],
|
||||
[title$="max"],
|
||||
[title$="memoryview"],
|
||||
[title$="min"],
|
||||
[title$="next"],
|
||||
[title$="object"],
|
||||
[title$="oct"],
|
||||
[title$="ord"],
|
||||
[title$="pow"],
|
||||
[title$="property"],
|
||||
[title$="repr"],
|
||||
[title$="reversed"],
|
||||
[title$="round"],
|
||||
[title$="setattr"],
|
||||
[title$="slice"],
|
||||
[title$="sorted"],
|
||||
[title$="staticmethod"],
|
||||
[title$="sum"],
|
||||
[title$="super"],
|
||||
[title$="vars"],
|
||||
[title$="zip"]
|
||||
) {
|
||||
color: var(--md-code-hl-constant-color);
|
||||
}
|
||||
|
||||
Loading…
Reference in new issue