mirror of
https://github.com/datahub-project/datahub.git
synced 2025-11-13 17:59:48 +00:00
docs(): add styles for sphinx generated python docs (#7773)
This commit is contained in:
parent
1fda92441f
commit
fd758deb3d
@ -199,6 +199,7 @@ module.exports = {
|
|||||||
? require.resolve("./src/styles/acryl.scss")
|
? require.resolve("./src/styles/acryl.scss")
|
||||||
: require.resolve("./src/styles/datahub.scss"),
|
: require.resolve("./src/styles/datahub.scss"),
|
||||||
require.resolve("./src/styles/global.scss"),
|
require.resolve("./src/styles/global.scss"),
|
||||||
|
require.resolve("./src/styles/sphinx.scss"),
|
||||||
require.resolve("./src/styles/config-table.scss"),
|
require.resolve("./src/styles/config-table.scss"),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,261 +0,0 @@
|
|||||||
/*
|
|
||||||
* basic.css
|
|
||||||
* ~~~~~~~~~
|
|
||||||
*
|
|
||||||
* Sphinx stylesheet -- basic theme.
|
|
||||||
*
|
|
||||||
* :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
|
|
||||||
* :license: BSD, see LICENSE for details.
|
|
||||||
*
|
|
||||||
* DataHub Modifications:
|
|
||||||
* - Removed most styles, which weren't super relevant.
|
|
||||||
* - Remove font-weight on dl.field-list > dt
|
|
||||||
* - Remove highlight-related styles.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* -- field list styles ----------------------------------------------------- */
|
|
||||||
|
|
||||||
table.field-list td, table.field-list th {
|
|
||||||
border: 0 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.field-list ul {
|
|
||||||
margin: 0;
|
|
||||||
padding-left: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.field-list p {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.field-name {
|
|
||||||
-moz-hyphens: manual;
|
|
||||||
-ms-hyphens: manual;
|
|
||||||
-webkit-hyphens: manual;
|
|
||||||
hyphens: manual;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- hlist styles ---------------------------------------------------------- */
|
|
||||||
|
|
||||||
table.hlist {
|
|
||||||
margin: 1em 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.hlist td {
|
|
||||||
vertical-align: top;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- object description styles --------------------------------------------- */
|
|
||||||
|
|
||||||
.sig {
|
|
||||||
font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sig-name, code.descname {
|
|
||||||
background-color: transparent;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sig-name {
|
|
||||||
font-size: 1.1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
code.descname {
|
|
||||||
font-size: 1.2em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sig-prename, code.descclassname {
|
|
||||||
background-color: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
.optional {
|
|
||||||
font-size: 1.3em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sig-paren {
|
|
||||||
font-size: larger;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sig-param.n {
|
|
||||||
font-style: italic;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* C++ specific styling */
|
|
||||||
|
|
||||||
.sig-inline.c-texpr,
|
|
||||||
.sig-inline.cpp-texpr {
|
|
||||||
font-family: unset;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sig.c .k, .sig.c .kt,
|
|
||||||
.sig.cpp .k, .sig.cpp .kt {
|
|
||||||
color: #0033B3;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sig.c .m,
|
|
||||||
.sig.cpp .m {
|
|
||||||
color: #1750EB;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sig.c .s, .sig.c .sc,
|
|
||||||
.sig.cpp .s, .sig.cpp .sc {
|
|
||||||
color: #067D17;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* -- other body styles ----------------------------------------------------- */
|
|
||||||
|
|
||||||
ol.arabic {
|
|
||||||
list-style: decimal;
|
|
||||||
}
|
|
||||||
|
|
||||||
ol.loweralpha {
|
|
||||||
list-style: lower-alpha;
|
|
||||||
}
|
|
||||||
|
|
||||||
ol.upperalpha {
|
|
||||||
list-style: upper-alpha;
|
|
||||||
}
|
|
||||||
|
|
||||||
ol.lowerroman {
|
|
||||||
list-style: lower-roman;
|
|
||||||
}
|
|
||||||
|
|
||||||
ol.upperroman {
|
|
||||||
list-style: upper-roman;
|
|
||||||
}
|
|
||||||
|
|
||||||
:not(li) > ol > li:first-child > :first-child,
|
|
||||||
:not(li) > ul > li:first-child > :first-child {
|
|
||||||
margin-top: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
:not(li) > ol > li:last-child > :last-child,
|
|
||||||
:not(li) > ul > li:last-child > :last-child {
|
|
||||||
margin-bottom: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
ol.simple ol p,
|
|
||||||
ol.simple ul p,
|
|
||||||
ul.simple ol p,
|
|
||||||
ul.simple ul p {
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ol.simple > li:not(:first-child) > p,
|
|
||||||
ul.simple > li:not(:first-child) > p {
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ol.simple p,
|
|
||||||
ul.simple p {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
aside.footnote > span,
|
|
||||||
div.citation > span {
|
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
aside.footnote > span:last-of-type,
|
|
||||||
div.citation > span:last-of-type {
|
|
||||||
padding-right: 0.5em;
|
|
||||||
}
|
|
||||||
aside.footnote > p {
|
|
||||||
margin-left: 2em;
|
|
||||||
}
|
|
||||||
div.citation > p {
|
|
||||||
margin-left: 4em;
|
|
||||||
}
|
|
||||||
aside.footnote > p:last-of-type,
|
|
||||||
div.citation > p:last-of-type {
|
|
||||||
margin-bottom: 0em;
|
|
||||||
}
|
|
||||||
aside.footnote > p:last-of-type:after,
|
|
||||||
div.citation > p:last-of-type:after {
|
|
||||||
content: "";
|
|
||||||
clear: both;
|
|
||||||
}
|
|
||||||
|
|
||||||
dl.field-list {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: fit-content(30%) auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
dl.field-list > dt {
|
|
||||||
/* font-weight: bold; */
|
|
||||||
word-break: break-word;
|
|
||||||
padding-left: 0.5em;
|
|
||||||
padding-right: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
dl.field-list > dd {
|
|
||||||
padding-left: 0.5em;
|
|
||||||
margin-top: 0em;
|
|
||||||
margin-left: 0em;
|
|
||||||
margin-bottom: 0em;
|
|
||||||
}
|
|
||||||
|
|
||||||
dl {
|
|
||||||
margin-bottom: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
dd > :first-child {
|
|
||||||
margin-top: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
dd ul, dd table {
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
dd {
|
|
||||||
margin-top: 3px;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
margin-left: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
dl > dd:last-child,
|
|
||||||
dl > dd:last-child > :last-child {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
dl.glossary dt {
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: 1.1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.line-block {
|
|
||||||
display: block;
|
|
||||||
margin-top: 1em;
|
|
||||||
margin-bottom: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.line-block .line-block {
|
|
||||||
margin-top: 0;
|
|
||||||
margin-bottom: 0;
|
|
||||||
margin-left: 1.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.guilabel, .menuselection {
|
|
||||||
font-family: sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
.accelerator {
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
.classifier {
|
|
||||||
font-style: oblique;
|
|
||||||
}
|
|
||||||
|
|
||||||
.classifier:before {
|
|
||||||
font-style: normal;
|
|
||||||
margin: 0 0.5em;
|
|
||||||
content: ":";
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
|
|
||||||
abbr, acronym {
|
|
||||||
border-bottom: dotted 1px;
|
|
||||||
cursor: help;
|
|
||||||
}
|
|
||||||
@ -59,12 +59,7 @@ def convert_html_to_md(html_file: pathlib.Path) -> str:
|
|||||||
title: {title}
|
title: {title}
|
||||||
---\n\n"""
|
---\n\n"""
|
||||||
|
|
||||||
styles = """
|
return md_meta + bs4_to_mdx(article)
|
||||||
import './basic.css';
|
|
||||||
|
|
||||||
\n"""
|
|
||||||
|
|
||||||
return md_meta + styles + bs4_to_mdx(article)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@ -79,11 +74,5 @@ def main():
|
|||||||
|
|
||||||
print(f"Generated {outfile}")
|
print(f"Generated {outfile}")
|
||||||
|
|
||||||
css = SPHINX_ROOT_DIR / "basic.css"
|
|
||||||
outfile = DOCS_OUTPUT_DIR.joinpath(css.name)
|
|
||||||
outfile.write_bytes(css.read_bytes())
|
|
||||||
print(f"Copied {css} to {outfile}")
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|||||||
124
docs-website/src/styles/sphinx.scss
Normal file
124
docs-website/src/styles/sphinx.scss
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
// Styles for Sphinx Python SDK generated docs
|
||||||
|
$borderRadius: 5px;
|
||||||
|
|
||||||
|
dl.py {
|
||||||
|
margin-bottom: calc(var(--ifm-spacing-vertical) * 2);
|
||||||
|
font-size: 14px;
|
||||||
|
border: 1px solid var(--ifm-hr-border-color);
|
||||||
|
border-radius: $borderRadius;
|
||||||
|
|
||||||
|
code {
|
||||||
|
border: none;
|
||||||
|
background: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
dl {
|
||||||
|
margin-bottom: var(--ifm-spacing-vertical);
|
||||||
|
}
|
||||||
|
|
||||||
|
// The parameter name:
|
||||||
|
em.sig-param > span:first-child {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
> dd:not(:empty) {
|
||||||
|
padding-bottom: var(--ifm-spacing-vertical);
|
||||||
|
}
|
||||||
|
|
||||||
|
dt.sig {
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
padding: var(--ifm-spacing-vertical);
|
||||||
|
border-radius: $borderRadius;
|
||||||
|
font-family: var(--ifm-font-family-monospace);
|
||||||
|
background-color: var(--ifm-background-surface-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
> dd {
|
||||||
|
&:not(:empty) {
|
||||||
|
padding-top: calc(var(--ifm-spacing-vertical) / 2);
|
||||||
|
margin-top: 0;
|
||||||
|
margin-left: var(--ifm-spacing-horizontal);
|
||||||
|
margin-right: var(--ifm-spacing-horizontal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// e.g. `class`, or `def`
|
||||||
|
em.property {
|
||||||
|
color: var(--ifm-font-color-base);
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
// e.g. `MyClass`
|
||||||
|
span.sig-name {
|
||||||
|
color: #2774b3;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
// e.g classmethod
|
||||||
|
em.property {
|
||||||
|
color: #66b327;
|
||||||
|
}
|
||||||
|
|
||||||
|
em.sig-param {
|
||||||
|
span.default_value {
|
||||||
|
color: #66b327;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
span.sig-return {
|
||||||
|
span.sig-return-typehint {
|
||||||
|
color: var(--ifm-font-color-base);
|
||||||
|
|
||||||
|
pre {
|
||||||
|
color: var(--ifm-font-color-base);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dl.field-list {
|
||||||
|
padding-top: calc(var(--ifm-spacing-vertical) / 2);
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: fit-content(30%) auto;
|
||||||
|
&:not(:first-child) {
|
||||||
|
border-top: 1px solid var(--ifm-hr-border-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
dt {
|
||||||
|
margin-right: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
dd {
|
||||||
|
font-family: var(--ifm-font-family-monospace);
|
||||||
|
}
|
||||||
|
|
||||||
|
dt,
|
||||||
|
dd {
|
||||||
|
margin-left: 0;
|
||||||
|
padding-left: 0;
|
||||||
|
|
||||||
|
&:not(:first-of-type) {
|
||||||
|
border-top: 1px solid var(--ifm-hr-border-color);
|
||||||
|
padding-top: var(--ifm-spacing-vertical);
|
||||||
|
}
|
||||||
|
&:not(:last-of-type) {
|
||||||
|
padding-bottom: var(--ifm-spacing-vertical);
|
||||||
|
}
|
||||||
|
|
||||||
|
ul {
|
||||||
|
list-style-type: none;
|
||||||
|
padding-left: 0;
|
||||||
|
li {
|
||||||
|
p {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user