Skip to content

Commit

Permalink
Fix header vertical spacing and jupyter-sphinx cells (#1164)
Browse files Browse the repository at this point in the history
Fixes undefined
  • Loading branch information
choldgraf authored Feb 10, 2023
1 parent fb03af0 commit 9025165
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 32 deletions.
28 changes: 14 additions & 14 deletions docs/examples/pydata.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,22 @@ data = xr.DataArray(
data
```

## ipyleaflet

`ipyleaflet` is a **Jupyter**/**Leaflet** bridge enabling interactive maps in the Jupyter notebook environment. this demonstrate how you can integrate maps in your documentation.

```{code-cell}
from ipyleaflet import Map, basemaps
from IPython.display import display
# display a map centered on France
m = Map(basemap=basemaps.Esri.WorldImagery, zoom=5, center=[46.21, 2.21])
display(m)
```

## jupyter-sphinx

Another common library is `jupyter-sphinx`.
This section demonstrates a subset of functionality above to make sure it behaves as expected.
This theme has styling for [`jupyter-sphinx`](https://jupyter-sphinx.readthedocs.io/), which is often used for executing and displaying widgets with a Jupyter kernel.

```{jupyter-execute}
import matplotlib.pyplot as plt
Expand All @@ -105,15 +117,3 @@ data = rng.standard_normal((3, 100))
fig, ax = plt.subplots()
ax.scatter(data[0], data[1], c=data[2], s=3)
```

## ipyleaflet

`ipyleaflet` is a **Jupyter**/**Leaflet** bridge enabling interactive maps in the Jupyter notebook environment. this demonstrate how you can integrate maps in your documentation.

```{jupyter-execute}
from ipyleaflet import Map, basemaps
# display a map centered on France
m = Map(basemap=basemaps.Esri.WorldImagery, zoom=5, center=[46.21, 2.21])
m
```
32 changes: 19 additions & 13 deletions src/pydata_sphinx_theme/assets/styles/extensions/_execution.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,27 @@
* Jupyter Sphinx
*/

// Dark theme special-cases
html[data-theme="dark"] .bd-content {
div.jupyter_container {
// Background has slightly more custom background behavior because of hard-coded color
border: 1px solid var(--pst-color-border);
background-color: var(--pst-color-surface);
border-radius: 0.25rem;
.bd-content div.jupyter_container {
// We don't want borders around the whole container, just around code cells
border: none;
background-color: unset;
box-shadow: none;

div.output,
div.highlight {
border-radius: 0.25rem;
}
// Code cells should have the same style as our other code objects
div.output,
div.highlight {
border-radius: 0.25rem;
}
div.highlight {
background-color: var(--pst-color-surface);
}

div.highlight {
background-color: var(--pst-color-surface);
// Ensure the style is the same as our code cells. Jupyter Sphinx makes it tiny.
.cell_input,
.cell_output {
border-radius: 0.25rem;
pre {
padding: 1rem;
}
}
}
20 changes: 15 additions & 5 deletions src/pydata_sphinx_theme/assets/styles/sections/_header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,14 @@
background: var(--pst-color-on-background) !important;
box-shadow: 0 0.125rem 0.25rem 0 var(--pst-color-shadow);

height: var(--pst-header-height);
max-height: var(--pst-header-height);
width: 100%;
padding: 0.5rem 0;
padding: 0;
max-width: 100vw;
justify-content: center;
.bd-header__inner {
display: flex;
align-items: center;
height: 100%;
height: fit-content;
padding-left: 1rem;
padding-right: 1rem;
}
Expand All @@ -36,6 +34,16 @@
flex-grow: 1;
padding: 0 0 0 0.5rem;
}

// These items will define the height of the header
.navbar-start-item,
.navbar-center-item,
.navbar-end-item {
height: var(--pst-header-height);
max-height: var(--pst-header-height);
display: flex;
align-items: center;
}
}

#navbar-end,
Expand All @@ -44,11 +52,13 @@
display: flex;
align-items: center;
flex-flow: wrap;
// In case we wrap our items to multiple rows on small screens
row-gap: 0;
}

#navbar-end,
#navbar-center {
gap: 1rem;
column-gap: 1rem;
}

// A little smaller because this is displayed by default on mobile
Expand Down

0 comments on commit 9025165

Please sign in to comment.