Skip to content

Commit 65667b8

Browse files
joelspadincaksoylar
authored andcommitted
docs: Add syntax highlighting to more code blocks
Added language tags to more code blocks in the documentation to enable syntax highlighting.
1 parent 4a33909 commit 65667b8

Some content is hidden

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

50 files changed

+215
-221
lines changed

docs/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@ The ZMK Documentation is licensed [CC-BY-NC-SA](http://creativecommons.org/licen
88

99
### Installation
1010

11-
```
11+
```sh
1212
$ npm ci
1313
```
1414

1515
### Local Development
1616

17-
```
17+
```sh
1818
$ npm start
1919
```
2020

2121
This command starts a local development server and open up a browser window. Most changes are reflected live without having to restart the server.
2222

2323
### Build
2424

25-
```
25+
```sh
2626
$ npm build
2727
```
2828

docs/blog/2020-10-03-bootloader-fix.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ So first I enabled logging of the NVS module by adding
7777
`CONFIG_NVS_LOG_LEVEL_DBG=y` to my `.conf` file. I repeated the same test of
7878
spamming RGB underglow effect cycle and the resulting logs I got were this:
7979

80-
```
80+
```log
8181
[00:00:00.000,671] <inf> fs_nvs: 8 Sectors of 4096 bytes
8282
[00:00:00.000,671] <inf> fs_nvs: alloc wra: 3, f70
8383
[00:00:00.000,671] <inf> fs_nvs: data wra: 3, f40
@@ -130,7 +130,7 @@ and [Dan Halbert](https://github.com/dhalbert) pointed me towards the [linker
130130
map](https://github.com/adafruit/Adafruit_nRF52_Bootloader/blob/master/linker/nrf52840.ld)
131131
of the nRF52840. Let's take a look.
132132

133-
```
133+
```linker-script
134134
FLASH (rx) : ORIGIN = 0xF4000, LENGTH = 0xFE000-0xF4000-2048 /* 38 KB */
135135
136136
BOOTLOADER_CONFIG (r): ORIGIN = 0xFE000 - 2048, LENGTH = 2048
@@ -166,7 +166,7 @@ Now that we've found the issue, we can pretty easily fix this. We'll need to
166166
move the settings flash area back so that it doesn't overlap with the
167167
bootloader. First we calculate the size of the of flash area the bootloader is using.
168168

169-
```
169+
```linker-script
170170
0x100000 (end of flash) - 0x0F4000 (start of bootloader) = 0xC000 (48KB)
171171
```
172172

docs/blog/2020-11-09-zmk-sotf-3.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ This also laid the foundation for the other keymap related changes that are now
3030

3131
[okke-formsma] added the ability to apply modifiers to a code, e.g.:
3232

33-
```
33+
```dts
3434
&kp LC(C)
3535
```
3636

@@ -63,7 +63,7 @@ and nice!nano that have specialized hardware for this purpose.
6363

6464
With this change, you can add
6565

66-
```
66+
```dts
6767
&ext_power EP_TOG
6868
```
6969

docs/blog/2021-01-27-zmk-sotf-4.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ The initial [combos](/docs/features/combos) work has landed! The amazing [okke-f
2525

2626
An example, that would send the `ESC` keycode when pressing both the first and second positions on your keyboard:
2727

28-
```
28+
```dts
2929
/ {
3030
combos {
3131
compatible = "zmk,combos";
@@ -46,13 +46,13 @@ Combos currently are "global", and not scoped to a given active layer. There is
4646

4747
[okke-formsma] also contributed the initial "sticky keys" behavior, which can be used for functionality sometimes called "one shot mods" or "one shot layers". In your keymap, this would like like:
4848

49-
```
49+
```dts
5050
&sk LEFT_CONTROL
5151
```
5252

5353
for a sticky key/modifier, or:
5454

55-
```
55+
```dts
5656
&sl NAV
5757
```
5858

@@ -68,7 +68,7 @@ This is most frequently used when using multiple core base layers with different
6868

6969
[okke-formsma] added an implementation of the "Grave Escape" behavior, developing a more generic "mod-morph" behavior to do so. Adding
7070

71-
```
71+
```dts
7272
&gresc
7373
```
7474

docs/blog/2022-04-02-zephyr-3-0.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ Existing user config repositories using Github Actions to build will pull down Z
2929
- Change `zmkfirmware/zmk-build-arm:2.5` to `zmkfirmware/zmk-build-arm:stable` wherever it is found
3030
- Locate and delete the lines for the DTS output step, which is no longer needed:
3131

32-
```
33-
- name: ${{ steps.variables.outputs.display-name }} DTS File
34-
if: ${{ always() }}
35-
run: |
36-
if [ -f "build/zephyr/${{ matrix.board }}.pre.tmp" ]; then cat -n build/zephyr/${{ matrix.board }}.pre.tmp; fi
37-
if [ -f "build/zephyr/zephyr.dts" ]; then cat -n build/zephyr/zephyr.dts; fi
32+
```yaml
33+
- name: ${{ steps.variables.outputs.display-name }} DTS File
34+
if: ${{ always() }}
35+
run: |
36+
if [ -f "build/zephyr/${{ matrix.board }}.pre.tmp" ]; then cat -n build/zephyr/${{ matrix.board }}.pre.tmp; fi
37+
if [ -f "build/zephyr/zephyr.dts" ]; then cat -n build/zephyr/zephyr.dts; fi
3838
```
3939
4040
:::note
@@ -76,7 +76,7 @@ The following changes have [already been completed](https://github.com/zmkfirmwa
7676

7777
Zephyr's WS2812 `led_strip` driver added a new required property. When adding [underglow](/docs/features/underglow#adding-rgb-underglow-to-a-board) to a board, you now must also add the additional include `#include <dt-bindings/led/led.h>` at the top of your devicetree file, and add a `color-mapping` property like:
7878

79-
```
79+
```dts
8080
led_strip: ws2812@0 {
8181
compatible = "worldsemi,ws2812-spi";
8282
label = "WS2812";
@@ -108,7 +108,7 @@ Zephyr moved to using a `chosen` node named `zephyr,display` to select the displ
108108

109109
For example, for a shield with:
110110

111-
```
111+
```dts
112112
&pro_micro_i2c {
113113
status = "okay";
114114
@@ -132,7 +132,7 @@ For example, for a shield with:
132132

133133
You would add a `chosen` node like:
134134

135-
```
135+
```dts
136136
/ {
137137
chosen {
138138
zephyr,display = &oled;
@@ -148,7 +148,7 @@ two sections of the `<board>.dts` file need updating.
148148

149149
Underneath the USB device, add the CDC ACM node:
150150

151-
```
151+
```dts
152152
&usbd {
153153
status = "okay";
154154
cdc_acm_uart: cdc_acm_uart {
@@ -160,7 +160,7 @@ Underneath the USB device, add the CDC ACM node:
160160

161161
Then, an additional `chosen` node (near the top of the file) will mark the CDC ACM device as the console:
162162

163-
```
163+
```dts
164164
/ {
165165
chosen {
166166
...
@@ -175,7 +175,7 @@ Then, an additional `chosen` node (near the top of the file) will mark the CDC A
175175
Previously, to get ZMK to build a UF2 image to flash to a given board required adding a `CMakeLists.txt` file that added a custom post build command.
176176
Now, the only thing necessary to have Zephyr build a UF2 is to add the following to your `<board>_defconfig` file:
177177

178-
```
178+
```ini
179179
CONFIG_BUILD_OUTPUT_UF2=y
180180
```
181181

@@ -187,7 +187,7 @@ For more details on the implementation, see [zephyr#31066](https://github.com/ze
187187

188188
Clock configuration moved to devicetree as well, out of the Kconfig files. Here is a sample config for a board that uses the HSI for the PLL source:
189189

190-
```
190+
```dts
191191
&clk_hsi {
192192
status = "okay";
193193
};

docs/blog/2022-04-10-zmk-sotf-5.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ to the host capitalized until a non-alpha, non-"continue list" keycode is sent.
3232

3333
[petejohanson], taking heavy inspiration on the initial work from [okke-formsma], added [macro support](/docs/behaviors/macros) in [#1168](https://github.com/zmkfirmware/zmk/pull/1166). Several [common patterns](/docs/behaviors/macros#common-patterns) are documented, but one example, changing the underglow color as you activate/deactivate a layer, looks like:
3434

35-
```
35+
```dts
3636
ZMK_MACRO(layer_color_macro,
3737
wait-ms = <0>;
3838
tap-ms = <0>;
@@ -50,7 +50,7 @@ ZMK_MACRO(layer_color_macro,
5050
[kurtis-lew] worked diligently to add the [tap-dance behavior](/docs/behaviors/tap-dance) in [#1139](https://github.com/zmkfirmware/zmk/pull/1139), allowing different behaviors to be invoked based on the number of times
5151
a user taps a single key in their keymap, e.g.
5252

53-
```
53+
```dts
5454
/ {
5555
behaviors {
5656
td0: tap_dance_0 {
@@ -80,7 +80,7 @@ a user taps a single key in their keymap, e.g.
8080

8181
Example:
8282

83-
```
83+
```dts
8484
/ {
8585
conditional_layers {
8686
compatible = "zmk,conditional-layers";
@@ -164,7 +164,7 @@ using "high voltage mode" with that SoC.
164164

165165
[petejohanson]'s work on the HID foundation also included adding support for full NKRO HID in [#726](https://github.com/zmkfirmware/zmk/pull/726) that can be enabled by adding the following to your `.conf` file for your config:
166166

167-
```
167+
```ini
168168
CONFIG_ZMK_HID_REPORT_TYPE_NKRO=y
169169
```
170170

@@ -176,7 +176,7 @@ It's been live for a while, but [nicell] added an amazing [power profiler](/powe
176176

177177
[malinges](https://github.com/malinges) added support for configuring min/max underglow brightness in [#944](https://github.com/zmkfirmware/zmk/pull/944) by setting the values in your `.conf` file as percentages of full:
178178

179-
```
179+
```ini
180180
CONFIG_ZMK_RGB_UNDERGLOW_BRT_MIN=20
181181
CONFIG_ZMK_RGB_UNDERGLOW_BRT_MAX=80
182182
```

docs/blog/2023-04-06-zephyr-3-2.md

+15-15
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Existing user config repositories using Github Actions to build will pull down Z
2626

2727
1. Replace the contents of your `.github/workflows/build.yml` with:
2828

29-
```
29+
```yaml
3030
on: [push, pull_request, workflow_dispatch]
3131

3232
jobs:
@@ -36,7 +36,7 @@ Existing user config repositories using Github Actions to build will pull down Z
3636
3737
1. If it doesn't exist already, add a new file to your repository named `build.yaml`:
3838

39-
```
39+
```yaml
4040
# This file generates the GitHub Actions matrix
4141
# For simple board + shield combinations, add them
4242
# to the top level board and shield arrays, for more
@@ -63,12 +63,12 @@ If you have a custom GitHub Actions workflow you need to maintain for some reaso
6363
- Change `zmkfirmware/zmk-build-arm:2.5` to `zmkfirmware/zmk-build-arm:stable` wherever it is found
6464
- Locate and delete the lines for the DTS output step, which is no longer needed:
6565

66-
```
67-
- name: ${{ steps.variables.outputs.display-name }} DTS File
68-
if: ${{ always() }}
69-
run: |
70-
if [ -f "build/zephyr/${{ matrix.board }}.pre.tmp" ]; then cat -n build/zephyr/${{ matrix.board }}.pre.tmp; fi
71-
if [ -f "build/zephyr/zephyr.dts" ]; then cat -n build/zephyr/zephyr.dts; fi
66+
```yaml
67+
- name: ${{ steps.variables.outputs.display-name }} DTS File
68+
if: ${{ always() }}
69+
run: |
70+
if [ -f "build/zephyr/${{ matrix.board }}.pre.tmp" ]; then cat -n build/zephyr/${{ matrix.board }}.pre.tmp; fi
71+
if [ -f "build/zephyr/zephyr.dts" ]; then cat -n build/zephyr/zephyr.dts; fi
7272
```
7373

7474
### VS Code & Docker (Dev Container)
@@ -107,7 +107,7 @@ A few testers have reported inconsistent issues with bluetooth connections on Wi
107107

108108
Zephyr 3.2 introduced [a new Kconfig setting](https://github.com/zephyrproject-rtos/zephyr/pull/48929) that can be used to work around a bug in Windows related to battery reporting. Check out our [bluetooth config](/docs/config/bluetooth) for the full details. The key new configuration that can be set if using Windows is:
109109

110-
```
110+
```ini
111111
CONFIG_BT_GATT_ENFORCE_SUBSCRIPTION=n
112112
```
113113

@@ -133,7 +133,7 @@ The main area this affects existing shields is those with board specific overrid
133133

134134
Previously in ZMK, we relied on per-driver devicetree source properties to set the alternate pin functions for things like SPI or I2C. For example, here is the I2C bus setup as it was previously on the `nice_nano` board:
135135

136-
```
136+
```dts
137137
&i2c0 {
138138
compatible = "nordic,nrf-twi";
139139
sda-pin = <17>;
@@ -143,7 +143,7 @@ Previously in ZMK, we relied on per-driver devicetree source properties to set t
143143

144144
With the move to the `pinctrl` system, this setup now look like:
145145

146-
```
146+
```dts
147147
&i2c0 {
148148
compatible = "nordic,nrf-twi";
149149
pinctrl-0 = <&i2c0_default>;
@@ -154,7 +154,7 @@ With the move to the `pinctrl` system, this setup now look like:
154154

155155
which references the `pinctrl` configuration:
156156

157-
```
157+
```dts
158158
&pinctrl {
159159
i2c0_default: i2c0_default {
160160
group1 {
@@ -185,7 +185,7 @@ The approach is the following when updating a _board_:
185185
1. Add a new file with the naming convention `<board>-pinctrl.dtsi` to your board directory.
186186
1. In the new file, add your `pinctrl` entries that set up different pin control configurations for whatever peripherals/buses are needed. Here's the nice!nano file as an example:
187187

188-
```
188+
```dts
189189
/*
190190
* Copyright (c) 2022 The ZMK Contributors
191191
* SPDX-License-Identifier: MIT
@@ -230,7 +230,7 @@ The approach is the following when updating a _board_:
230230
1. From the main `<board>.dts` file, add an `#include "<board>-pinctrl.dtsi"` to have the C-preprocessor combine the files.
231231
1. Update the various peripheral nodes to use the new `pinctrl` configurations. For example, the following old configuration:
232232

233-
```
233+
```dts
234234
&i2c0 {
235235
compatible = "nordic,nrf-twi";
236236
sda-pin = <15>;
@@ -240,7 +240,7 @@ The approach is the following when updating a _board_:
240240

241241
would be changed to:
242242

243-
```
243+
```dts
244244
&i2c0 {
245245
compatible = "nordic,nrf-twi";
246246
pinctrl-0 = <&i2c0_default>;

docs/blog/2023-06-18-encoder-refactors.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Splitting these two parts of the encoder configuration allows greater flexibilit
3535

3636
Previously, an encoder configuration looked like:
3737

38-
```
38+
```dts
3939
left_encoder: encoder_left {
4040
compatible = "alps,ec11";
4141
label = "LEFT_ENCODER";
@@ -47,7 +47,7 @@ Previously, an encoder configuration looked like:
4747

4848
Here, the `resolution` property was used to indicate how many encoder pulses should trigger the sensor behavior one time. Next, the encoder is selected in the sensors node:
4949

50-
```
50+
```dts
5151
sensors {
5252
compatible = "zmk,keymap-sensors";
5353
sensors = <&left_encoder &right_encoder>;
@@ -58,7 +58,7 @@ That was the entirety of the configuration for encoders.
5858

5959
### New Configuration
6060

61-
```
61+
```dts
6262
left_encoder: encoder_left {
6363
compatible = "alps,ec11";
6464
label = "LEFT_ENCODER";
@@ -70,7 +70,7 @@ That was the entirety of the configuration for encoders.
7070

7171
Here, the `steps` property is now used to indicate how many encoder pulses there are in a single complete rotation of the encoder. Next, the encoder is selected in the sensors node as before, but an additional configuration is used to indicate how many times the encoder should trigger the behavior in your keymap per rotation:
7272

73-
```
73+
```dts
7474
sensors {
7575
compatible = "zmk,keymap-sensors";
7676
sensors = <&left_encoder &right_encoder>;
@@ -84,7 +84,7 @@ For tactile encoders that have detents, the `triggers-per-rotation` would match
8484

8585
The configuration changes bring ZMK's code in line with how upstream Zephyr sensor drivers handle rotations. This has the added advantage of allowing us to leverage other sensor drivers. On Nordic MCUs, like nRF52840, the NRFX QDEC driver can be used, for example:
8686

87-
```
87+
```dts
8888
&pinctrl {
8989
qdec_default: qdec_default {
9090
group1 {

0 commit comments

Comments
 (0)