Skip to content

Commit 627e266

Browse files
authored
Merge pull request #21946 from LasseRosenow/guides-use-file-tree-component
doc: migrate file trees in guides to starlight TreeView component
2 parents 526ac4c + 55fa9dc commit 627e266

File tree

8 files changed

+130
-96
lines changed

8 files changed

+130
-96
lines changed

dist/tools/buildsystem_sanity_check/check.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ check_cpu_cpu_model_defined_in_makefile_features() {
214214
patterns+=(-e '^ *\(export\)\? *CPU \??\?=')
215215
patterns+=(-e '^ *\(export\)\? *CPU_MODEL \??\?=')
216216
pathspec+=(':!**.md')
217+
pathspec+=(':!**.mdx')
217218
pathspec+=(':!boards/**/Makefile.features')
218219
pathspec+=(':!cpu/**/Makefile.features')
219220

doc/guides/advanced_tutorials/creating_application.md renamed to doc/guides/advanced_tutorials/creating_application.mdx

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ title: Creating an Application
33
description: How to create your own application for RIOT
44
---
55

6+
import FileTree from '@components/FileTree.astro';
7+
68
To create your own application you need to create a directory containing one or
79
multiple C file(s) with your source code and a Makefile. A template Makefile is
810
available in the `dist` folder of the
@@ -241,21 +243,23 @@ tree applications, modules and boards are supported.
241243
For a full application with custom board and modules, the following directory
242244
tree can be used:
243245

244-
```
245-
├── apps
246-
│ └── my_app
247-
│ └── Makefile
248-
├── boards
249-
│ └── my_board
250-
├── modules
251-
│ └── my_module
252-
│ ├── include
253-
│ │ └── my_module.h
254-
│ ├── Makefile
255-
│ ├── Makefile.include
256-
│ └── my_module.c
257-
└── RIOT
258-
```
246+
<FileTree>
247+
248+
- apps
249+
- my_app
250+
- Makefile
251+
- boards
252+
- my_board/
253+
- modules
254+
- my_module
255+
- include
256+
-my_module.h
257+
- Makefile
258+
- Makefile.include
259+
- my_module.c
260+
- RIOT/
261+
262+
</FileTree>
259263

260264
In this example tree, the `apps` directory contains a collection of applications
261265
for the project. The modules directory could contain extra modules for the

doc/guides/advanced_tutorials/creating_modules.md renamed to doc/guides/advanced_tutorials/creating_modules.mdx

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ title: Creating Modules
33
description: Guide on how to create modules in RIOT-OS
44
---
55

6+
import FileTree from '@components/FileTree.astro';
7+
68
Modules in RIOT are well-defined units of code that provide a set of features
79
to your application. This includes also drivers and to a certain extent ports
810
for CPUs and boards (with some exceptions, see the
@@ -47,13 +49,12 @@ in the linker which can be hard to track down.
4749

4850
This problem happened in the past for:
4951

50-
* Packages root directory (libfixmath/u8g2)
51-
* boards/cpu/periph and their common boards/cpu/periph
52+
* Packages root directory (libfixmath/u8g2)
53+
* boards/cpu/periph and their common boards/cpu/periph
5254

5355
Note: even if all boards and cpus implement the `board` and `cpu` modules, only
5456
one is used in an application so there is no conflict.
5557

56-
5758
## Module Dependencies
5859

5960
Your module may depend on other modules to minimize code duplication. These
@@ -77,6 +78,7 @@ the user needs to add the directory (or directories) containing external modules
7778
to `EXTERNAL_MODULE_DIRS`.
7879

7980
External modules can optionally define the following files:
81+
8082
* `Makefile.include` file to set global build configuration like `CFLAGS` or add
8183
API headers include paths to the `USEMODULE_INCLUDES` variable.
8284
* `Makefile.dep` file to set module dependencies
@@ -114,12 +116,14 @@ These modules appear in RIOT under two forms:
114116

115117
1. Conditionally included source files:
116118

117-
```
118-
foo
119-
├── foo_bar.c
120-
├── foo.c
121-
└── Makefile
122-
```
119+
<FileTree>
120+
121+
- foo
122+
- foo_bar.c
123+
- foo.c
124+
- Makefile
125+
126+
</FileTree>
123127

124128
In `foo/Makefile` you add the source file to the `SRC` variable, conditioned on
125129
the Pseudomodule inclusion
@@ -134,13 +138,16 @@ See `sys/net/ble/skald` for an example in code.
134138

135139
2. Using the `SUBMODULES` mechanism:
136140

137-
```
138-
foo
139-
├── spam.c
140-
├── ham.c
141-
├── eggs.c
142-
└── Makefile
143-
```
141+
142+
<FileTree>
143+
144+
- foo
145+
- spam.c
146+
- ham.c
147+
- eggs.c
148+
- Makefile
149+
150+
</FileTree>
144151

145152
```makefile
146153
# make all code end up in "foo_bar.a", this can be any name
@@ -181,16 +188,19 @@ implementation.
181188
The module source files are created in the `sys` directory.
182189

183190
From the RIOT base directory, run:
191+
184192
```sh
185193
make generate-module
186194
```
195+
187196
Then answer a few questions about the driver:
188-
- Module name: enter a name for your module. It will be used as both the name
197+
198+
* Module name: enter a name for your module. It will be used as both the name
189199
of the module directory under sys, where the source files are created, and
190200
the build system module (used with `USEMODULE`).
191-
- Module doxygen name: Enter the name of module, as displayed in the
201+
* Module doxygen name: Enter the name of module, as displayed in the
192202
Doxygen documentation.
193-
- Brief doxygen description: Describe in one line what is this module about.
203+
* Brief doxygen description: Describe in one line what is this module about.
194204

195205
Other global information (author name, email, organization) should be retrieved
196206
automatically from your git configuration.

doc/guides/advanced_tutorials/porting_boards.md renamed to doc/guides/advanced_tutorials/porting_boards.mdx

Lines changed: 57 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ title: Porting Boards
33
description: Guide on how to port new boards to RIOT-OS
44
---
55

6+
import FileTree from '@components/FileTree.astro';
7+
68
At some point you might need to port a new `BOARD` to `RIOT`, either because
79
that specific development board is not yet supported or because you have a
810
custom `BOARD` for your project.
@@ -31,21 +33,23 @@ Makefiles. Usually a `BOARD` directory has the following structure,
3133
although not all of the subdirectories or Makefiles have to be present for
3234
a board implementation to work.
3335

34-
```
35-
board-foo
36-
├── dist
37-
│ └── scripts
38-
├── board.c
39-
├── doc.md
40-
├── include
41-
│ ├── periph_conf.h
42-
│ ├── board.h
43-
│ └── gpio_params.h
44-
├── Makefile
45-
├── Makefile.dep
46-
├── Makefile.features
47-
└── Makefile.include
48-
```
36+
<FileTree>
37+
38+
- board-foo
39+
- dist
40+
- scripts/
41+
- board.c
42+
- doc.md
43+
- include
44+
- periph_conf.h
45+
- board.h
46+
- gpio_params.h
47+
- Makefile
48+
- Makefile.dep
49+
- Makefile.features
50+
- Makefile.include
51+
52+
</FileTree>
4953

5054
### Source Files
5155

@@ -430,22 +434,24 @@ The directory structure of a common folder is very similar to the board
430434
folder structure and not all files and folders have to be present except for
431435
the main `Makefile`.
432436

433-
```
434-
RIOT
435-
└── boards
436-
└── common
437-
└── adafruit-nrf52-bootloader
438-
├── board.c
439-
├── doc.md
440-
├── include
441-
│ ├── periph_conf.h
442-
│ ├── board.h
443-
│ └── gpio_params.h
444-
├── Makefile
445-
├── Makefile.dep
446-
├── Makefile.features
447-
└── Makefile.include
448-
```
437+
<FileTree>
438+
439+
- RIOT
440+
- boards
441+
- common
442+
- adafruit-nrf52-bootloader
443+
- board.c
444+
- doc.md
445+
- include
446+
- periph_conf.h
447+
- board.h
448+
- gpio_params.h
449+
- Makefile
450+
- Makefile.dep
451+
- Makefile.features
452+
- Makefile.include
453+
454+
</FileTree>
449455

450456
The main `Makefile` defines the module name for the common board module and
451457
should follow the general naming scheme of `boards_common_awesome-common-stuff`.
@@ -502,25 +508,26 @@ external boards, e.g.: `EXTERNAL_BOARD_DIRS=/home/external-boards/` (this would
502508
commonly be done in your application `Makefile` or your environment). You can
503509
specify multiple directories separated by spaces.
504510

505-
```
506-
/home
507-
├── RIOT
508-
│ └── ...
509-
└── external-boards
510-
└── board-foo
511-
├── dist
512-
│ └── scripts
513-
├── board.c
514-
├── doc.md
515-
├── include
516-
│ ├── periph_conf.h
517-
│ ├── board.h
518-
│ └── gpio_params.h
519-
├── Makefile
520-
├── Makefile.dep
521-
├── Makefile.features
522-
└── Makefile.include
523-
```
511+
<FileTree>
512+
513+
- home
514+
- RIOT/
515+
- external-boards
516+
- board-foo
517+
- dist
518+
- scripts/
519+
- board.c
520+
- doc.md
521+
- include
522+
- periph_conf.h
523+
- board.h
524+
- gpio_params.h
525+
- Makefile
526+
- Makefile.dep
527+
- Makefile.features
528+
- Makefile.include
529+
530+
</FileTree>
524531

525532
If the external `BOARD` is very similar to a `BOARD` already present in
526533
`RIOTBOARD`, the external `BOARD` (`board-foo`) can inherit from that
Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ description: Learn how to use CoAP with RIOT
44
code_folder: examples/guides/coap
55
---
66

7+
import FileTree from '@components/FileTree.astro';
8+
79
CoAP (Constrained Application Protocol) is a protocol to implement REST APIs
810
for constrained devices and networks.
911
It is designed for IoT applications and is similar to HTTP but much lighter.
@@ -24,11 +26,13 @@ that will feature a more streamlined API and additional functionality.
2426

2527
Create a new directory for your project:
2628

27-
```text
28-
coap-hello-server
29-
├── Makefile
30-
└── main.c
31-
```
29+
<FileTree>
30+
31+
- coap-hello-server
32+
- Makefile
33+
- main.c
34+
35+
</FileTree>
3236

3337
### Step 2: Create the Makefile
3438

@@ -152,11 +156,13 @@ BOARD=arduino-feather-nrf52840-sense make all flash term
152156

153157
Create a new directory for your project:
154158

155-
```text
156-
coap-hello-client
157-
├── Makefile
158-
└── main.c
159-
```
159+
<FileTree>
160+
161+
- coap-hello-client
162+
- Makefile
163+
- main.c
164+
165+
</FileTree>
160166

161167
### Step 2: Create the Makefile
162168

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// @ts-check
21
import { defineConfig } from "astro/config";
32
import starlight from "@astrojs/starlight";
43
import rehypeGithubEmoji from "rehype-github-emoji";
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
import { FileTree as StarlightFileTree } from "@astrojs/starlight/components";
3+
---
4+
5+
<StarlightFileTree>
6+
<slot />
7+
</StarlightFileTree>

doc/starlight/src/pages/changelog.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
import StarlightPage from "@astrojs/starlight/components/StarlightPage.astro";
3-
import { LinkButton, LinkCard } from "@astrojs/starlight/components";
3+
import { LinkButton, LinkCard, FileTree } from "@astrojs/starlight/components";
44
import { getCollection } from "astro:content";
55
66
const changelog = await getCollection("changelog");

0 commit comments

Comments
 (0)