Skip to content

Commit 3748cf1

Browse files
committed
fix: markdownlint
1 parent cb8946c commit 3748cf1

12 files changed

Lines changed: 51 additions & 15 deletions

.markdownlint.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"MD013": false,
3+
"MD025": false,
34
"MD033": {
45
"allowed_elements": ["div", "h1", "p", "strong", "a", "sub"]
56
},

CONTRIBUTING.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ When adding a new ros-z feature:
116116
- Use `{{#include ../../ros-z/examples/your_example.rs}}` to reference the example
117117
- Update `book/src/SUMMARY.md` if adding a new chapter
118118
4. **Test everything**:
119+
119120
```bash
120121
cargo build
121122
cargo test
@@ -240,7 +241,7 @@ Follow conventional commit format:
240241

241242
## Project Structure
242243

243-
```
244+
```text
244245
ros-z/
245246
├── ros-z/ # Core library
246247
│ ├── src/ # Production code
@@ -260,16 +261,19 @@ ros-z/
260261
### If-Then Flows
261262

262263
**IF adding new ros-z feature:**
264+
263265
- ADD `examples/new_feature.rs`
264266
- ADD/UPDATE book chapter with `{{#include}}`
265267
- RUN `cargo build && mdbook test book -L ./target/debug/deps`
266268

267269
**IF making API breaking change:**
270+
268271
- UPDATE `examples/*.rs` files
269272
- UPDATE book text references
270273
- Single commit: "feat: new API + examples + docs"
271274

272275
**IF mdbook test fails:**
276+
273277
- RUN `cargo clean && cargo build`
274278
- CHECK `target/debug/deps` contains `libros_z-*.rlib`
275279
- RE-RUN `mdbook test book -L ./target/debug/deps`

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Comprehensive documentation with examples is available:
3838
- **Local**: Build and view locally with `mdbook serve book` (see [book/README.md](book/README.md))
3939

4040
The documentation includes:
41+
4142
- Getting started guide
4243
- Publisher/subscriber examples
4344
- Service examples

WORKFLOW_STATUS.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The suggested two-Cargo.toml approach is **NOT needed**. The current structure a
66

77
## Current Structure (Already Optimal)
88

9-
```
9+
```text
1010
ros-z/ # Workspace root
1111
├── Cargo.toml # Workspace definition
1212
├── ros-z/ # Library crate
@@ -81,8 +81,8 @@ required-features = ["external_msgs"]
8181
### ✅ 4. mdBook Can Test Examples
8282

8383
```bash
84-
$ cargo build
85-
$ mdbook test book -L ./target/debug/deps
84+
cargo build
85+
mdbook test book -L ./target/debug/deps
8686
```
8787

8888
The `-L ./target/debug/deps` flag links examples against the compiled library.
@@ -149,6 +149,7 @@ jobs:
149149
**✅ Keep the current structure** - it's optimal and follows Rust best practices.
150150
151151
**❌ Don't implement the two-Cargo.toml approach** - it would:
152+
152153
- Add unnecessary complexity
153154
- Break existing include paths (20+ files to update)
154155
- Create a non-standard project structure
@@ -166,16 +167,19 @@ jobs:
166167
## Next Steps
167168
168169
1. **Reload nix environment** to get mdbook:
170+
169171
```bash
170172
direnv allow
171173
```
172174

173175
2. **Run the full workflow**:
176+
174177
```bash
175178
./test-docs.sh
176179
```
177180

178181
3. **Preview the book**:
182+
179183
```bash
180184
mdbook serve book
181185
```

book/QUICK_REFERENCE.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ The `mdbook test` command tests **every Rust code block** in your markdown files
2424
```
2525

2626
This code block will be:
27+
2728
1. Extracted by mdbook
2829
2. Compiled with rustc
2930
3. Linked against `libros_z.rlib` (from `target/debug/deps`)
@@ -93,7 +94,8 @@ mdbook test book -L ./target/debug/deps
9394
```
9495

9596
Without `-L ./target/debug/deps`, the test will fail with:
96-
```
97+
98+
```text
9799
error[E0463]: can't find crate for `ros_z`
98100
```
99101

@@ -125,12 +127,15 @@ Runs automatically on every push and pull request.
125127
1. Create `ros-z/examples/my_feature.rs`
126128
2. Add chapter `book/src/chapters/my_feature.md`
127129
3. Include the example:
130+
128131
```markdown
129132
\`\`\`rust,no_run
130133
{{#include ../../../ros-z/examples/my_feature.rs}}
131134
\`\`\`
132135
```
136+
133137
4. Test it:
138+
134139
```bash
135140
cargo build --example my_feature # Verify example compiles
136141
mdbook test book -L ./target/debug/deps # Verify book sees it

book/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ mdbook test book -L ./target/debug/deps
5151
```
5252

5353
This command:
54+
5455
- Tests all Rust code blocks in the book chapters
5556
- Uses `-L ./target/debug/deps` to link against the compiled ros-z library
5657
- Validates that all `{{#include}}` directives work correctly
@@ -79,7 +80,7 @@ See [TESTING.md](TESTING.md) for detailed information about testing.
7980

8081
The current structure follows **standard Rust practices**:
8182

82-
```
83+
```text
8384
ros-z/ # Workspace root
8485
├── ros-z/ # Library crate
8586
│ ├── Cargo.toml # Has ALL dependencies (clap, tokio, etc.)
@@ -91,6 +92,7 @@ ros-z/ # Workspace root
9192
```
9293

9394
**Why this works:**
95+
9496
- ✅ Examples in `ros-z/examples/` have access to all dependencies
9597
-`cargo run --example name` works out of the box
9698
-`mdbook test` finds examples via `{{#include ../../../ros-z/examples/...}}`
@@ -110,7 +112,7 @@ The output will be in `book/book/` directory.
110112

111113
## Book Structure
112114

113-
```
115+
```text
114116
book/
115117
├── book.toml # mdBook configuration
116118
└── src/

book/TESTING.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ This document explains how to test that all code examples in the book compile an
55
## The `mdbook test` Command
66

77
mdBook has a built-in test command that:
8+
89
1. Extracts all Rust code blocks from markdown files
910
2. Compiles them as mini test programs
1011
3. Links them against your library
@@ -29,14 +30,15 @@ mdbook test book -L ./target/debug/deps
2930
```
3031

3132
**Explanation:**
33+
3234
- `mdbook test book` - Test all code blocks in the book
3335
- `-L ./target/debug/deps` - Tell the Rust compiler where to find the compiled `ros-z` library
3436

3537
### Expected Output
3638

3739
On success, you'll see:
3840

39-
```
41+
```text
4042
2025-12-16 [INFO] (mdbook::book): Book building has started
4143
2025-12-16 [INFO] (mdbook::book): Running the html backend
4244
2025-12-16 [INFO] (mdbook::renderer::html_handlebars::search): Index built in ...
@@ -52,14 +54,14 @@ test result: ok. 15 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
5254

5355
If an example fails to compile, you'll see detailed error messages:
5456

55-
```
57+
```text
5658
test book/src/chapters/example.md - example::rust_1 (line 5) ... FAILED
5759
5860
error[E0425]: cannot find value `xyz` in this scope
5961
--> /tmp/.tmpXYZ/main.rs:5:10
6062
|
6163
5 | let x = xyz;
62-
| ^^^ not found in this scope
64+
| ^^^ not found in this scope
6365
```
6466

6567
## Code Block Annotations
@@ -209,18 +211,20 @@ Or use the Nix pre-commit hooks (already configured in the development shell).
209211
2. **Use `no_run` for full programs**: Examples with `main()` that run indefinitely
210212
3. **Use `ignore` sparingly**: Only for pseudo-code or intentionally incomplete examples
211213
4. **Test locally before pushing**: Run the full workflow:
214+
212215
```bash
213216
cargo build
214217
cargo test
215218
mdbook test book -L ./target/debug/deps
216219
```
220+
217221
5. **Keep examples simple**: Complex examples are harder to test in documentation
218222

219223
## Understanding Test Output
220224

221225
Each test corresponds to a code block:
222226

223-
```
227+
```text
224228
test book/src/chapters/demo_talker.md - demo_talker::rust_1 (line 11) ... ok
225229
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^
226230
File path Test name Line number
@@ -235,6 +239,7 @@ When a test fails:
235239
1. **Check the file and line number** in the error message
236240
2. **Extract the code block** from the markdown
237241
3. **Try compiling manually**:
242+
238243
```bash
239244
# Create a test file
240245
cat > test.rs << 'EOF'
@@ -247,6 +252,7 @@ When a test fails:
247252
# Compile it
248253
rustc --edition 2021 -L target/debug/deps --extern ros_z test.rs
249254
```
255+
250256
4. **Fix the issue** in the example file (not the markdown!)
251257
5. **Update the markdown** if needed (should auto-update if using `{{#include}}`)
252258
6. **Re-run**: `mdbook test book -L ./target/debug/deps`

book/WORKFLOW_VERIFICATION.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This document verifies that the complete workflow works as intended.
44

55
## Current Structure (Optimal)
66

7-
```
7+
```text
88
ros-z/ # Workspace root
99
├── Cargo.toml # Workspace definition
1010
├── ros-z/ # Library crate
@@ -71,6 +71,7 @@ mdbook test book -L ./target/debug/deps
7171
```
7272

7373
**How it works:**
74+
7475
1. `cargo build` creates `libros_z-*.rlib` in `target/debug/deps/`
7576
2. `mdbook test` extracts code blocks from markdown
7677
3. `-L ./target/debug/deps` tells rustc where to find the library
@@ -81,14 +82,16 @@ mdbook test book -L ./target/debug/deps
8182
### Step 4: Include Paths Work
8283

8384
Book chapters use:
85+
8486
```markdown
8587
\`\`\`rust,no_run
8688
{{#include ../../../ros-z/examples/demo_nodes/talker.rs}}
8789
\`\`\`
8890
```
8991

9092
**Path resolution:**
91-
```
93+
94+
```text
9295
book/src/chapters/demo_talker.md
9396
↓ ../
9497
book/src/
@@ -133,6 +136,7 @@ path = "examples/demo_nodes/talker.rs"
133136
```
134137

135138
Benefits:
139+
136140
- ✅ Examples automatically have access to all dependencies
137141
-`cargo build` builds everything
138142
-`cargo run --example` works out of the box
@@ -143,13 +147,14 @@ Benefits:
143147

144148
Some suggest making examples a separate workspace member:
145149

146-
```
150+
```text
147151
examples/
148152
├── Cargo.toml # Separate package
149153
└── *.rs
150154
```
151155

152156
Problems:
157+
153158
- ❌ Non-standard structure
154159
- ❌ Breaks `{{#include}}` paths (need to update 20+ files)
155160
- ❌ More complex `cargo` commands
@@ -169,6 +174,7 @@ GitHub Actions (`.github/workflows/docs.yml`) runs:
169174
```
170175
171176
This ensures:
177+
172178
1. Library compiles
173179
2. Tests pass
174180
3. **All documentation examples compile and work**
@@ -195,6 +201,7 @@ X = "version"
195201
```
196202

197203
Then rebuild:
204+
198205
```bash
199206
cargo build
200207
mdbook test book -L ./target/debug/deps
@@ -210,6 +217,7 @@ cargo build --example demo_nodes_talker
210217
```
211218

212219
Or add the feature:
220+
213221
```bash
214222
cargo build --example z_srvcli --features external_msgs
215223
```

book/src/chapters/actions.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ Actions provide a mechanism for long-running tasks in ROS 2, with the ability to
1010
## Overview
1111

1212
Actions are useful for tasks that:
13+
1314
- Take a long time to complete
1415
- Need to provide progress updates
1516
- May need to be cancelled
1617

1718
Common examples include:
19+
1820
- Navigation to a goal
1921
- Gripper control
2022
- Long computations

book/src/chapters/demo_add_two_ints_server.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ cargo run --example demo_nodes_add_two_ints_client -- --a 10 --b 20
6262

6363
Expected output:
6464

65-
```
65+
```text
6666
# Server output:
6767
Incoming request
6868
a: 10 b: 20

0 commit comments

Comments
 (0)