Skip to content

Commit 68e1575

Browse files
authored
Convert to MySTMD (#315)
1 parent f43b605 commit 68e1575

48 files changed

Lines changed: 606 additions & 229 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.gitignore‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
.hugo*
21
*~
3-
resources/
42
public/
3+
_build/
4+
content/_build/
55
.DS_Store

‎.gitmodules‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
[submodule "themes/scientific-python-hugo-theme"]
2-
path = themes/scientific-python-hugo-theme
3-
url = https://github.com/scientific-python/scientific-python-hugo-theme
41
[submodule "external-content/cookie"]
52
path = external-content/cookie
63
url = https://github.com/scientific-python/cookie

‎Makefile‎

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: help prepare cookie external html serve clean
1+
.PHONY: help prepare cookie external html serve build-serve clean
22
.DEFAULT_GOAL := help
33

44
# Add help text after each target name starting with '\#\#'
@@ -18,17 +18,23 @@ cookie:
1818

1919
external: cookie
2020

21-
html: ## Build learn site (without external content) in `./public`
21+
html: ## Build learn site in `./content/_build/html`
2222
html: prepare
23-
hugo
23+
(cd content && myst build --html)
2424

25-
html-all: ## Buildlearn site (with external content) in `./public`
26-
html-all: html external
25+
html-all: ## Build learn site with external content in `./public`
26+
html-all: html
27+
mkdir -p public && cp -r content/_build/html/. public/
28+
$(MAKE) external
2729

28-
serve: ## Serve site, typically on http://localhost:1313
30+
serve: ## Serve site, typically on http://localhost:3000
2931
serve: prepare
30-
@hugo --printI18nWarnings server
32+
(cd content && myst start)
33+
34+
build-serve: ## Build full site (learn + cookie) and serve `./public` at http://localhost:3000
35+
build-serve: html-all
36+
python3 scripts/serve.py 3000 public
3137

3238
clean: ## Remove built files
3339
clean:
34-
rm -rf public
40+
rm -rf content/_build public

‎README.md‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,36 @@
11
# learn.scientific-python.org
2+
3+
Source for [learn.scientific-python.org](https://learn.scientific-python.org),
4+
built with [MyST-MD](https://mystmd.org/) (the `mystmd` CLI).
5+
6+
## Layout
7+
8+
- `content/` — the MyST source project (`myst.yml` lives here). This is the
9+
main site.
10+
- `external-content/cookie/` — the [cookie](https://github.com/scientific-python/cookie)
11+
submodule, a separate MyST site. Its build is overlaid at `/development/`.
12+
- `public/` — build output. The merged, deployable static site (main +
13+
cookie). Written by `make html-all`; published by Netlify.
14+
15+
## Prerequisites
16+
17+
- **mystmd** — the `myst` CLI. See the
18+
[MyST install guide](https://mystmd.org/guide/quickstart).
19+
- **Node** — the cookie overlay builds via `npx mystmd`, so a full build needs
20+
Node available.
21+
- **git** — the cookie content is a submodule; `make prepare` initializes it.
22+
23+
## Local development
24+
25+
| Command | What it does |
26+
| ------------------ | ----------------------------------------------------------------------- |
27+
| `make serve` | Live-reload dev server for the **main site only**, at `localhost:3000`. |
28+
| `make html` | Build the main site to `content/_build/html/`. |
29+
| `make html-all` | Build main + cookie, merged into `public/`. |
30+
| `make build-serve` | Run `html-all`, then serve the full merged site at `localhost:3000`. |
31+
| `make clean` | Remove build output (`content/_build`, `public/`). |
32+
33+
**Previewing `/development/` (cookie) locally:** `make serve` (and `myst start`)
34+
serve `content/` only — the cookie overlay is **not** visible there. To preview
35+
the full site, including `/development/`, use `make build-serve`. It is a static
36+
build (no live reload); rerun it after edits.

‎assets/css/custom.css‎

Lines changed: 0 additions & 3 deletions
This file was deleted.

‎config.yaml‎

Lines changed: 0 additions & 73 deletions
This file was deleted.

‎content/.copier-answers.yml‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
2+
_commit: 9002ff6
3+
_src_path: gh:scientific-python/scientific-python-myst-theme
4+
favicon: https://raw.githubusercontent.com/scientific-python/scientific-python.org/main/static/favicon.ico
5+
footer_items_json: assets/json/footer_items.json
6+
project_name: Learn Scientific Python
7+
project_url: learn.scientific-python.org
File renamed without changes.
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
body {
2+
display: flex;
3+
flex-direction: column;
4+
min-height: 100vh;
5+
}
6+
7+
main {
8+
min-height: 0;
9+
flex: 1 0 auto;
10+
}
11+
12+
.article.content {
13+
/* Override 100vh from myst-theme:styles/typography.css so content div
14+
* doesn't grow <main> to push the footer offscreen.
15+
*/
16+
min-height: 0;
17+
}
18+
19+
.footer {
20+
/* Make footer "sticky" to page bottom (also the above flex rules), per
21+
* the flexbox strategy described here:
22+
* https://css-tricks.com/couple-takes-sticky-footer/#aa-there-is-flexbox
23+
* and here:
24+
* https://philipwalton.github.io/solved-by-flexbox/demos/sticky-footer/
25+
* This solution does not require hardcoding a fixed footer height in the
26+
* style rules.
27+
*/
28+
flex-shrink: 0;
29+
background: #013243;
30+
color: white;
31+
padding-left: 2rem;
32+
padding-right: 2rem;
33+
34+
/* Outer content grid */
35+
& .outer-grid {
36+
/* logo, project description, link columns, social icons */
37+
grid-template-columns: 2fr 6fr 8fr 3fr;
38+
column-gap: 4rem;
39+
align-items: center;
40+
margin: 0rem 4rem;
41+
42+
& li {
43+
list-style: none;
44+
}
45+
}
46+
47+
@media (max-width: 640px) {
48+
& .outer-grid {
49+
grid-template-columns: 1fr;
50+
justify-items: start;
51+
}
52+
}
53+
54+
/* Heading colours */
55+
& a,
56+
h1,
57+
h2,
58+
h3,
59+
h4,
60+
h5,
61+
h6 {
62+
color: white;
63+
}
64+
65+
& h1 {
66+
font-size: 1.25rem;
67+
font-weight: bold;
68+
}
69+
& .footer-links {
70+
column-gap: 1.5rem;
71+
line-height: normal;
72+
73+
& a {
74+
color: white;
75+
text-decoration-color: white;
76+
display: inline-block;
77+
white-space: nowrap;
78+
79+
/* MyST renders external links as
80+
* <a class="whitespace-nowrap"><span class="link-text whitespace-normal">.
81+
* Override the span so multi-word labels stay on one line. */
82+
& .link-text {
83+
white-space: nowrap;
84+
}
85+
}
86+
}
87+
88+
& .footer-icons {
89+
column-gap: 3rem;
90+
row-gap: 1rem;
91+
92+
& img {
93+
filter: invert(100%);
94+
margin-bottom: 0.1rem;
95+
margin-top: 0.1rem;
96+
min-width: 1.75rem;
97+
width: 1.75rem;
98+
}
99+
}
100+
}
101+
102+
.footer-logo {
103+
min-width: 60px;
104+
}
105+
106+
/* Hide download button */
107+
.myst-fm-downloads-button {
108+
display: none;
109+
}
110+
111+
/* Set site title bold */
112+
.myst-home-link {
113+
font-weight: bold;
114+
}
115+
116+
/* Unsure where this CSS came from, but keeping it for now */
117+
/* --- Make layout feel less "book-ish" and closer to a website --- */
118+
.bd-main .bd-content .bd-article-container {
119+
max-width: 900px; /* keep readable, less wide than default "docs" feel */
120+
}
121+
122+
h1,
123+
h2,
124+
h3,
125+
h4 {
126+
letter-spacing: -0.01em;
127+
}
128+
129+
/* Slightly tighten the top spacing so it feels more like a marketing/docs site */
130+
.bd-header {
131+
box-shadow: none;
132+
}
133+
134+
/* If the left sidebar feels too dominant, reduce its visual weight */
135+
.bd-sidebar-primary {
136+
border-right: 0;
137+
}
138+
139+
.copyright {
140+
font-size: smaller;
141+
}

‎content/assets/icons/README.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
You can find more free icons at:
2+
3+
- https://fonts.google.com/icons (Search and then click the SVG download button at the bottom of the right-hand column.)
4+
- https://simpleicons.org/
5+
6+
Apache licensed, but with a notice at https://github.com/google/material-design-icons:
7+
8+
> We'd love attribution in your app's about screen, but it's not required.

0 commit comments

Comments
 (0)