Skip to content

Commit 9d1644d

Browse files
committed
Add pre-commit with markdownlint
Add some rule exceptions and fix remaining issues.
1 parent 1825796 commit 9d1644d

15 files changed

Lines changed: 75 additions & 28 deletions

File tree

‎.github/workflows/markdownlint.yml‎

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,28 @@
1-
name: markdownlint
1+
name: pre-commit
22
on: [pull_request, push]
33
jobs:
4-
mdl:
4+
pre-commit:
5+
name: pre-commit checks
56
runs-on: ubuntu-latest
7+
68
steps:
7-
- name: Check out code
8-
uses: actions/checkout@v2
9-
- name: Run mdl
10-
uses: actionshub/markdownlint@main
9+
- name: Checkout repository
10+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
11+
12+
- name: Set up Python
13+
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
14+
with:
15+
python-version: "3.14"
16+
17+
- name: Cache pre-commit environments
18+
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
19+
with:
20+
path: ~/.cache/pre-commit
21+
key: pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
22+
23+
- name: Install pre-commit
24+
run: python -m pip install "pre-commit==4.6.1"
25+
26+
- name: Run pre-commit
27+
run: pre-commit run --all-files --show-diff-on-failure --color=always
28+

‎.markdownlint.json‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"MD007": { "indent": 4 },
3+
"MD012": false,
4+
"MD013": { "line_length": 999 },
5+
"MD032": false,
6+
"MD033": false,
7+
"MD034": false,
8+
"MD041": false,
9+
"MD045": false,
10+
"MD060": false
11+
}

‎.pre-commit-config.yaml‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
repos:
2+
- repo: https://github.com/igorshubovych/markdownlint-cli
3+
rev: v0.49.1
4+
hooks:
5+
- id: markdownlint
6+
- id: markdownlint-fix
7+

‎01_version_control/git_quiz.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ cat motivation.txt
2929
- `Documenting major milestones.`
3030
- The following:
3131

32-
```
32+
```text
3333
Sharing information about myself.
3434
Documenting major milestones.
3535
```

‎01_version_control/merge_rebase_slides.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ slideOptions:
9090

9191
- `git log`
9292

93-
```
93+
```text
9494
3e70cb5 8 seconds .. Merge branch 'feature' HEAD -> main
9595
607a08a 18 seconds.. E feature
9696
2e4f61f 28 seconds.. C

‎01_version_control/my_favorite_neat_little_git_trick_demo.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
- GitHub uses [gitignore templates](https://github.com/github/gitignore) if you create a `.gitignore` file from GitHub
1111
- To get a nice compact `git log`, you can add the following to your `gitconfig`:
1212

13-
```
13+
```rc
1414
[format]
1515
pretty = format:%C(auto,yellow)%h %C(auto,blue)%>(12,trunc)%ad %C(auto,green)%<(20,trunc)%aN%C(auto,reset)%s%C(auto,red)% gD% D
1616
```
@@ -24,7 +24,7 @@
2424
- Prefer `git add -p` over `git add [FILE]`. This allows you to specify what you want to add to a commit in a more fine-grained manner
2525
- A very nice alias for editing any earlier commit, without having to manually rebase:
2626
27-
```
27+
```rc
2828
[alias]
2929
amend = "!f() { \
3030
COMMIT=$(git rev-parse --short \"$1\") && \
@@ -45,7 +45,7 @@
4545
- GitHub uses [gitignore templates](https://github.com/github/gitignore) if you create a `.gitignore` file from GitHub
4646
- To get a nice compact `git log`, you can add the following to your `gitconfig`:
4747
48-
```
48+
```rc
4949
[format]
5050
pretty = format:%C(auto,yellow)%h %C(auto,blue)%>(12,trunc)%ad %C(auto,green)%<(20,trunc)%aN%C(auto,reset)%s%C(auto,red)% gD% D
5151
```
@@ -76,7 +76,7 @@
7676
- GitHub uses [gitignore templates](https://github.com/github/gitignore) if you create a `.gitignore` file from GitHub
7777
- To get a nice compact `git log`, you can add the following to your `gitconfig`:
7878
79-
```
79+
```rc
8080
[format]
8181
pretty = format:%C(auto,yellow)%h %C(auto,blue)%>(12,trunc)%ad %C(auto,green)%<(20,trunc)%aN%C(auto,reset)%s%C(auto,red)% gD% D
8282
```
@@ -93,7 +93,7 @@
9393
9494
### A helpful git config
9595
96-
```
96+
```rc
9797
[push]
9898
default = simple
9999
autoSetupRemote = true

‎01_version_control/standards_slides.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ Certain files lead to special formatting (normally directly at root of repo):
7373
## Special Files (3)
7474

7575
- `CITATION.cff`
76-
- ... contains preferred citation details.
77-
- ... gets rendered on the sidebar.
78-
- ... export to BibTeX.
76+
- ... contains preferred citation details.
77+
- ... gets rendered on the sidebar.
78+
- ... export to BibTeX.
7979
- `AGENTS.md`
80-
- ... contains context and instructions for GenAI.
81-
- ... more and more coding agents read it.
80+
- ... contains context and instructions for GenAI.
81+
- ... more and more coding agents read it.
8282

8383

8484
---

‎03_building_and_packaging/make_demo.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ int main()
4343

4444
`Makefile`:
4545

46+
<!-- markdownlint-configure-file {"MD010": false } -->
47+
4648
```makefile
4749
sse.o : sse/sse.hpp sse/sse.cpp
4850
$(CXX) -c sse/sse.cpp
@@ -72,7 +74,7 @@ helloworld : main.cpp sse.o
7274
- `mkdir clean` and `make clean` confuses Make.
7375
- phony target (a helper target, doesn't correspond to a file)
7476

75-
```
77+
```makefile
7678
+ .PHONY : all clean
7779
```
7880

‎04_documentation/examples/pandoc/example.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ author: Firstname lastname
44
date: 2026-01-07
55
---
66

7-
# Introduction
7+
## Introduction
88

99
This is text, **bold text**, *italic text*, and `inline code`.
1010

‎04_documentation/technical_writing_slides.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ a community of technical writers.
128128

129129
## Documentation Content Should Be
130130

131+
<!-- markdownlint-configure-file {"MD059": false } -->
132+
131133
- **ARID** (*"Accept (some) Repetition in Documentation"*)
132134
- Not like good code (**DRY**: *"don't repeat yourself"*),
133135
but also not **WET**

0 commit comments

Comments
 (0)