Skip to content

Commit d32d4e8

Browse files
authored
chore: use rumdl for Markdown formatting (#9)
Move Markdown formatting from prettier to rumdl (mystmd flavor for content/, standard for the Marp slides/). prettier stays for the non-Markdown files (CSS, JSON, YAML) via an `\.md$` exclude. rumdl fmt's directive-aware fixes (MD031) add blank lines around MyST directives; MD013/MD033/MD026/MD076 are disabled as they don't fit prose/slide content. Assisted-by: ClaudeCode:claude-opus-4.8
1 parent 367901f commit d32d4e8

6 files changed

Lines changed: 40 additions & 3 deletions

File tree

.pre-commit-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,16 @@ repos:
3333
hooks:
3434
- id: nbstripout
3535

36+
- repo: https://github.com/rvben/rumdl-pre-commit
37+
rev: "5c0245ee573b1dea03e8cdc5bd41bd449ea8962a" # frozen: v0.2.27
38+
hooks:
39+
- id: rumdl-fmt
40+
3641
- repo: https://github.com/rbubley/mirrors-prettier
3742
rev: "515f543f5718ebfd6ce22e16708bb32c68ff96e1" # frozen: v3.8.3
3843
hooks:
3944
- id: prettier
45+
exclude: '\.md$' # Markdown is handled by rumdl
4046

4147
- repo: https://github.com/codespell-project/codespell
4248
rev: "2ccb47ff45ad361a21071a7eedda4c37e6ae8c5a" # frozen: v2.4.2

.rumdl.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[global]
2+
# This is prose-heavy content, not source-tree Markdown.
3+
disable = [
4+
"MD013", # Line length — prose and code samples are not hard-wrapped
5+
"MD033", # Inline HTML — Marp slides use <div class="columns"> etc.
6+
"MD026", # Trailing punctuation in headings — slide headings intentionally end in ":"
7+
"MD076", # Blank line between list items — false-positives inside mixed-indent MyST :::{card}
8+
]
9+
10+
# content/ is MyST (directives, roles); slides/ are Marp (standard Markdown + HTML).
11+
[per-file-flavor]
12+
"content/**/*.md" = "myst"

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ bun run build # build book + slides into _build/html/ (build-book then b
1414
bun run build-book # myst build --html
1515
bun run build-slides # marp slides/ -> _build/html/slides/
1616
bun run clean # rm -rf _build
17-
prek -a --quiet # lint/format everything (ruff-format, blacken-docs, prettier, codespell, etc.)
17+
prek -a --quiet # lint/format everything (ruff-format, blacken-docs, rumdl, prettier, codespell, etc.)
1818
```
1919

2020
## Structure

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
This workshop is a work in progress. Check back soon!
44

5-
See https://scikit-build.org/events/simple-py/ for info on the workshop!
5+
See <https://scikit-build.org/events/simple-py/> for info on the workshop!

content/basic-packaging/01_setup.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,15 @@ When Python runs, it checks to see if there's a `pyvenv.cfg` above it. If there
6565
it is in a virtual environment (venv) and reads site-packages from there. There are two ways to use it:
6666

6767
::::{tab-set}
68+
6869
:::{tab-item} Direct usage
6970

7071
```bash
7172
.venv/bin/python ...
7273
```
7374

7475
:::
76+
7577
:::{tab-item} Activation
7678

7779
```bash
@@ -81,6 +83,7 @@ deactivate
8183
```
8284

8385
:::
86+
8487
::::
8588

8689
> [!WARNING]
@@ -95,7 +98,9 @@ The `.` at the start (most shells support `source` as well) allows the activatio
9598
To create one of these, you have several options:
9699

97100
:::::{card} Create a virtual environment
101+
98102
::::{tab-set}
103+
99104
:::{tab-item} venv
100105

101106
```bash
@@ -105,6 +110,7 @@ python3 -m venv .venv
105110
This is the slowest, but it's built in![^1]
106111

107112
:::
113+
108114
:::{tab-item} virtualenv
109115

110116
```bash
@@ -114,6 +120,7 @@ virtualenv .venv
114120
This is faster than `venv`, has better default installs inside, but does require installation.
115121

116122
:::
123+
117124
:::{tab-item} uv
118125

119126
```bash
@@ -123,7 +130,9 @@ uv venv
123130
This is really fast, though it's completely empty (no pip). And it defaults to `.venv`. Also requires installation (a single Rust binary or pip install).
124131

125132
:::
133+
126134
::::
135+
127136
:::::
128137

129138
We will be using `uv`, which can do a lot of this for us.
@@ -137,7 +146,9 @@ Now that you know how to make virtual environments, how should you install stuff
137146
But a virtual environment is meant to be expendable. You should be able to delete it and recreate it any time. So instead of manually installing, you want to list packages in some format:
138147

139148
:::::{grid} 1 1 2 2
149+
140150
::::{grid-item}
151+
141152
:::{card} Project (app)
142153
These are for making a virtual env. They don't affect libraries.
143154

@@ -148,8 +159,11 @@ These are for making a virtual env. They don't affect libraries.
148159
- **Lock file**: Versions are pinned exactly
149160
- **dependency-groups**: Multiple collections of packages
150161
:::
162+
151163
::::
164+
152165
::::{grid-item}
166+
153167
:::{card} Package (library)
154168
These are for libraries.
155169

@@ -164,7 +178,9 @@ Most libraries also have developer environments, which follows the "Project
164178
> for these too; this is due to it pre-dating `dependency-groups`.
165179
166180
:::
181+
167182
::::
183+
168184
:::::
169185

170186
Locked dependencies means that every dependency is fully specified, ideally
@@ -296,20 +312,23 @@ if __name__ == "__main__":
296312
When you run it:
297313

298314
::::{tab-set}
315+
299316
:::{tab-item} uv
300317

301318
```bash
302319
uv run single.py
303320
```
304321

305322
:::
323+
306324
:::{tab-item} pipx
307325

308326
```bash
309327
pipx run single.py
310328
```
311329

312330
:::
331+
313332
::::
314333

315334
The dependencies will be downloaded into a temporary venv.

slides/1_01_setup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ System or user installs sound nice, but:
7474

7575
## Virtual environment structure
7676

77-
```
77+
```text
7878
.venv
7979
├── .gitignore
8080
├── CACHEDIR.TAG

0 commit comments

Comments
 (0)