Skip to content

Commit

Permalink
DOC: Use qrenderer.scss
Browse files Browse the repository at this point in the history
  • Loading branch information
has2k1 committed Feb 15, 2024
1 parent f7f0353 commit bc90a20
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 280 deletions.
1 change: 1 addition & 0 deletions doc/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/.quarto/
qrenderer.scss
10 changes: 9 additions & 1 deletion doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ for line in sys.stdin:
endef
export PRINT_HELP_PYSCRIPT

QRENDERER_STYLE_FILE=qrenderer.scss
QRENDERER_STYLE_URL=https://raw.githubusercontent.com/has2k1/qrenderer/main/doc/qrenderer.scss

help:
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
Expand All @@ -26,6 +28,12 @@ clean: ## Remove build artefacts
rm -rf _site/
rm -rf _inv/

download_qrenderer_style: ## Download qrenderer.scss
@if [ ! -f $(QRENDERER_STYLE_FILE) ]; then \
echo "Downloading $(QRENDERER_STYLE_FILE)"; \
wget $(QRENDERER_STYLE_URL) -O $(QRENDERER_STYLE_FILE); \
fi

interlink: ## Gather interlinks
quartodoc interlinks

Expand All @@ -35,7 +43,7 @@ config: ## Configure project for quartodoc and quarto
docstrings: config ## Generate qmd files from the docstrings
quartodoc build --config _quartodoc.yml

html: docstrings ## Build html site
html: docstrings download_qrenderer_style ## Build html site
quarto render

doc: clean interlink html ## Build html documentation from a clean slate
Expand Down
1 change: 1 addition & 0 deletions doc/_quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ format:
toc: true
theme:
- lumen
- qrenderer.scss
- custom.scss

filters:
Expand Down
282 changes: 3 additions & 279 deletions doc/custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,72 +4,14 @@

/*-- scss:defaults --*/
$primary: #9E2F68;
$table-striped-bg: #F0F6F6;
$font-family-base: "Source Sans Pro";
$font-family-code: "Source Code Pro";
$table-striped-order: even;
$headings-font-weight: 300 !default;

$class-symbol-color: $primary;
$method-symbol-color: #D95F02;
$function-symbol-color: #7570B3;
$alias-symbol-color: #E7298A;
$module-symbol-color: #377EB8;
$attribute-symbol-color: #1B9E77;
$type-symbol-color: #BE6900;
$typevar-symbol-color: #8E0000;

$signature-border-color: tint-color($primary, 25%);
$signature-background-color: shade-color(tint-color($primary, 95%), 2.5%);
/*-- scss:mixins --*/

/*-- scss:rules --*/

a {
text-decoration: none;
}

h2, .h2 {
border-bottom: 0rem;
}

// Set headings boldness back to the bootstrap default.
// quarto changes it for h1, h2, h3!
h1, .h2, h2, .h2, h3, .h3 {
@extend .fw-medium;
}

h5, .h5 {
@extend .mt-3;
}

table {
@extend .table-bordered;
@extend .table-striped;
}

.table > tbody {
// quarto adds a bottom color that is different from the border color,
// that looks good the default
border-bottom-color: $table-border-color;
}

// The default background color for the dropdown is
// off-white and it washes out the text color.
.navbar .dropdown-item {
color: $gray-800;
}

// docstring spacing and indentation
section.doc-attributes > section.doc-attribute,
section.doc-methods > section.doc-method {
@extend .ps-4;
border-left: 0.025rem solid $gray-500;
backgroud-color: cyan;
}
$signature-border-color: tint-color($primary, 25%);

// docstring signatures
.doc-signature > div:first-child {
background-color: $signature-background-color;
border-top: 0.25rem solid $signature-border-color;
}

Expand All @@ -78,85 +20,6 @@ section .doc-signature > div:first-child {
border-left: 0.25rem solid $signature-border-color;
}

.doc-signature > p:first-child {
background-color: $signature-background-color;
}

.doc-signature code {
max-height: 20rem;
overflow: auto;
}

.doc-signature > p:first-child {
@extend .my-3;
border-radius: 0.25rem;
}

.doc-signature > p:first-child code {
@extend .p-2;
display: block;
background-color: unset;
}

.doc-signature > p:first-child code a {
color: $primary;
}

// docstring object-name

.doc-object span.doc-object-name:not(h1.title > span) {
opacity: 0.85;
}

// docstring definition-items
.doc-definition-items dt {
font-weight: normal;
}

.doc-definition-items > dl > dt:not(:first-child) {
@extend .mt-3;
}

.doc-definition-items > dl > dd {
@extend .mt-1;
@extend .mb-0;
@extend .ms-5;
}

.doc-definition-items > dl > dd > table {
min-width: 33%;
width: 0;
}

.doc-definition-items > dl > dd > table > thead {
border-top: 0rem solid $border-color;
border-bottom: 0.15em solid $border-color;
}

.doc-definition-items > dl > dd > table td {
@extend .px-2;
@extend .py-1;
}

// Definitions that are code
.doc-definition-items dt code,
.doc-signature > p > code {
@extend .py-1;
display: block;
font-weight: normal;
color: var(--quarto-hl-ot-color);
}

.doc-definition-items dt code a,
.doc-signature > p > code a {
color: $primary;
}

// docstring object symbols
.content code.doc-symbol {
font-size: 0.9rem;
}

// gallery

.gallery>.card {
Expand Down Expand Up @@ -194,147 +57,8 @@ section .doc-signature > div:first-child {
object-fit: contain;
}

// Reference/Index

// Give all the tables on the index page the same with.
// It looks better, but as table cells do not respond to
// min-width styling, this is not a perfect solution.
.doc-index .doc-summary-table td:first-child{
width: 30%;
}

// sidebar

.sidebar code.doc-symbol {
@extend .px-1;
font-size: 0.55rem;
}

.sidebar ul > li > a:has(.doc-symbol) {
white-space: nowrap;
}

.content code.doc-symbol-class,
.sidebar code.doc-symbol-class {
color: $class-symbol-color;
background-color: tint-color($class-symbol-color, 95%);
}

.content code.doc-symbol-method,
.sidebar code.doc-symbol-method {
color: $method-symbol-color;
background-color: tint-color($method-symbol-color, 95%);
}

.content code.doc-symbol-module,
.sidebar code.doc-symbol-module {
color: $module-symbol-color;
background-color: tint-color($module-symbol-color, 95%);
}

.content code.doc-symbol-function,
.sidebar code.doc-symbol-function {
color: $function-symbol-color;
background-color: tint-color($function-symbol-color, 95%);
}

.content code.doc-symbol-alias,
.sidebar code.doc-symbol-alias {
color: $alias-symbol-color;
background-color: tint-color($alias-symbol-color, 95%);
}

.content code.doc-symbol-attribute,
.sidebar code.doc-symbol-attribute {
color: $attribute-symbol-color;
background-color: tint-color($attribute-symbol-color, 95%);
}

.content code.doc-symbol-type,
.sidebar code.doc-symbol-type {
color: $type-symbol-color;
background-color: tint-color($type-symbol-color, 95%);
}

.content code.doc-symbol-typevar,
.sidebar code.doc-symbol-typevar {
color: $typevar-symbol-color;
background-color: tint-color($typevar-symbol-color, 95%);
}

code.doc-symbol-class::after {
content: "class";
}

code.doc-symbol-method::after {
content: "meth";
}

code.doc-symbol-module::after {
content: "mod";
}

code.doc-symbol-function::after {
content: "func";
}

code.doc-symbol-alias::after {
content: "alias";
}

code.doc-symbol-attribute::after {
content: "attr";
}

code.doc-symbol-type::after {
content: "type";
}

code.doc-symbol-typevar::after {
content: "typevar";
}

// docstring object labels

.content code.doc-label {
@extend .fw-normal;
@extend .small;
font-size: 0.785rem;
color: $gray-800;
background-color: $gray-100;
}

.content code.doc-label-staticmethod::after {
content: "staticmethod";
}

.content code.doc-label-classmethod::after {
content: "classmethod";
}

.content code.doc-label-abstractmethod::after {
content: "abstractmethod";
}

.content code.doc-label-cached::after {
content: "cached";
}

.content code.doc-label-property::after {
content: "property";
}

.content code.doc-label-overload::after {
content: "typing.overload";
}

.content code.doc-label-protocol::after {
content: "Protocol";
}


/*-- scss:mixins --*/

/*-- scss:functions --*/

/*-- scss:uses --*/

0 comments on commit bc90a20

Please sign in to comment.