Skip to content

Commit

Permalink
Documentation fixes (#108)
Browse files Browse the repository at this point in the history
* Fix typo in getting started
* Fix dark mode hiding some output in the notebooks
* Fix the displaced copy button in one liner input boxes
  • Loading branch information
alihamdan committed Aug 1, 2023
1 parent 5e9fe44 commit d27ea0d
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 7 deletions.
5 changes: 5 additions & 0 deletions doc/_static/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,8 @@ dl dd:not(:last-child) {
font-size: var(--toc-font-size);
text-align: center;
}

/* Align the copy button in the middle of the first line */
.highlight button.copybtn {
top: 0.25rem;
}
47 changes: 47 additions & 0 deletions doc/_static/css/notebooks.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/* This stylesheet is applied to nbsphinx notebooks only */

/* Hide execution count */
/* https://nbsphinx.readthedocs.io/en/latest/custom-css.html#For-a-Single-Notebook */
.nbinput .prompt,
.nboutput .prompt {
display: none;
}

/* Fix hidden rows in output of dataframes and pint quantities in dark mode */
/* Make colors hardcoded in nbsphinx/_static/nbsphinx-code-cells.css_t aware of the theme */
:root {
--nbsphinx-table-and-thead-border-color: black;
--nbsphinx-tbody-tr-nth-child-odd-color: #f5f5f5;
}

body[data-theme='dark'] {
--nbsphinx-table-and-thead-border-color: white;
--nbsphinx-tbody-tr-nth-child-odd-color: #5f5f5f;
}

@media (prefers-color-scheme: dark) {
body:not([data-theme="light"]) {
--nbsphinx-table-and-thead-border-color: white;
--nbsphinx-tbody-tr-nth-child-odd-color: #5f5f5f;
}
}

.jp-RenderedHTMLCommon table,
div.rendered_html table {
color: var(--nbsphinx-table-and-thead-border-color);
}

.jp-RenderedHTMLCommon thead,
div.rendered_html thead {
border-bottom: 1px solid var(--nbsphinx-table-and-thead-border-color);
}

.jp-RenderedHTMLCommon tbody tr:nth-child(odd),
div.rendered_html tbody tr:nth-child(odd) {
background: var(--nbsphinx-tbody-tr-nth-child-odd-color);
}

/* Disable copy button in output */
div.output_area > div > button.copybtn {
display: none;
}
9 changes: 3 additions & 6 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#
# import os
# import sys
from pathlib import Path

# sys.path.insert(0, os.path.abspath("../roseau/"))

Expand Down Expand Up @@ -133,15 +134,11 @@

# -- Options for intersphinx -------------------------------------------------
nbsphinx_execute = "never"
# Hide execution count https://nbsphinx.readthedocs.io/en/latest/custom-css.html#For-a-Single-Notebook
nbsphinx_prolog = """
nbsphinx_prolog = f"""
.. raw:: html
<style>
.nbinput .prompt,
.nboutput .prompt {
display: none;
}
{" ".join(Path("_static/css/notebooks.css").read_text().splitlines(keepends=True))}
</style>
"""

Expand Down
2 changes: 1 addition & 1 deletion doc/notebooks/Getting_Started.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@
"Roseau Load Flow uses the [Pint](https://pint.readthedocs.io/en/stable/) `Quantity` objects to\n",
"present the data in unit-agnostic way for the user. All input data (load powers, source voltages,\n",
"etc.) are expected to be either given in SI units or using the pint Quantity interface for non-SI\n",
"units (example below). The `length` parameter of the `Line` class that is an exception where the\n",
"units (example below). The `length` parameter of the `Line` class is an exception where the\n",
"default unit is Kilometers.\n",
"\n",
"Example, create a load with powers expressed in kVA:\n",
Expand Down

0 comments on commit d27ea0d

Please sign in to comment.