Skip to content

Commit 9025165

Browse files
authored
Fix header vertical spacing and jupyter-sphinx cells (#1164)
Fixes undefined
1 parent fb03af0 commit 9025165

File tree

3 files changed

+48
-32
lines changed

3 files changed

+48
-32
lines changed

docs/examples/pydata.md

+14-14
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,22 @@ data = xr.DataArray(
9191
data
9292
```
9393

94+
## ipyleaflet
95+
96+
`ipyleaflet` is a **Jupyter**/**Leaflet** bridge enabling interactive maps in the Jupyter notebook environment. this demonstrate how you can integrate maps in your documentation.
97+
98+
```{code-cell}
99+
from ipyleaflet import Map, basemaps
100+
from IPython.display import display
101+
102+
# display a map centered on France
103+
m = Map(basemap=basemaps.Esri.WorldImagery, zoom=5, center=[46.21, 2.21])
104+
display(m)
105+
```
106+
94107
## jupyter-sphinx
95108

96-
Another common library is `jupyter-sphinx`.
97-
This section demonstrates a subset of functionality above to make sure it behaves as expected.
109+
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.
98110

99111
```{jupyter-execute}
100112
import matplotlib.pyplot as plt
@@ -105,15 +117,3 @@ data = rng.standard_normal((3, 100))
105117
fig, ax = plt.subplots()
106118
ax.scatter(data[0], data[1], c=data[2], s=3)
107119
```
108-
109-
## ipyleaflet
110-
111-
`ipyleaflet` is a **Jupyter**/**Leaflet** bridge enabling interactive maps in the Jupyter notebook environment. this demonstrate how you can integrate maps in your documentation.
112-
113-
```{jupyter-execute}
114-
from ipyleaflet import Map, basemaps
115-
116-
# display a map centered on France
117-
m = Map(basemap=basemaps.Esri.WorldImagery, zoom=5, center=[46.21, 2.21])
118-
m
119-
```

src/pydata_sphinx_theme/assets/styles/extensions/_execution.scss

+19-13
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,27 @@
1010
* Jupyter Sphinx
1111
*/
1212

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

21-
div.output,
22-
div.highlight {
23-
border-radius: 0.25rem;
24-
}
19+
// Code cells should have the same style as our other code objects
20+
div.output,
21+
div.highlight {
22+
border-radius: 0.25rem;
23+
}
24+
div.highlight {
25+
background-color: var(--pst-color-surface);
26+
}
2527

26-
div.highlight {
27-
background-color: var(--pst-color-surface);
28+
// Ensure the style is the same as our code cells. Jupyter Sphinx makes it tiny.
29+
.cell_input,
30+
.cell_output {
31+
border-radius: 0.25rem;
32+
pre {
33+
padding: 1rem;
2834
}
2935
}
3036
}

src/pydata_sphinx_theme/assets/styles/sections/_header.scss

+15-5
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,14 @@
1313
background: var(--pst-color-on-background) !important;
1414
box-shadow: 0 0.125rem 0.25rem 0 var(--pst-color-shadow);
1515

16-
height: var(--pst-header-height);
17-
max-height: var(--pst-header-height);
1816
width: 100%;
19-
padding: 0.5rem 0;
17+
padding: 0;
2018
max-width: 100vw;
2119
justify-content: center;
2220
.bd-header__inner {
2321
display: flex;
2422
align-items: center;
25-
height: 100%;
23+
height: fit-content;
2624
padding-left: 1rem;
2725
padding-right: 1rem;
2826
}
@@ -36,6 +34,16 @@
3634
flex-grow: 1;
3735
padding: 0 0 0 0.5rem;
3836
}
37+
38+
// These items will define the height of the header
39+
.navbar-start-item,
40+
.navbar-center-item,
41+
.navbar-end-item {
42+
height: var(--pst-header-height);
43+
max-height: var(--pst-header-height);
44+
display: flex;
45+
align-items: center;
46+
}
3947
}
4048

4149
#navbar-end,
@@ -44,11 +52,13 @@
4452
display: flex;
4553
align-items: center;
4654
flex-flow: wrap;
55+
// In case we wrap our items to multiple rows on small screens
56+
row-gap: 0;
4757
}
4858

4959
#navbar-end,
5060
#navbar-center {
51-
gap: 1rem;
61+
column-gap: 1rem;
5262
}
5363

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

0 commit comments

Comments
 (0)