docs: Add syntax highlighting to more code blocks

Added language tags to more code blocks in the documentation to enable
syntax highlighting.
This commit is contained in:
Joel Spadin
2023-10-06 22:05:49 -05:00
committed by Cem Aksoylar
parent 4a339093ce
commit 65667b863a
50 changed files with 215 additions and 221 deletions

View File

@@ -12,7 +12,7 @@ This page contains [backlight](../features/backlight.md) behaviors supported by
Backlight actions defines are provided through the [`dt-bindings/zmk/backlight.h`](https://github.com/zmkfirmware/zmk/blob/main/app/include/dt-bindings/zmk/backlight.h) header,
which is added at the top of the keymap file:
```
```dts
#include <dt-bindings/zmk/backlight.h>
```
@@ -46,13 +46,13 @@ However the settings will only be saved after [`CONFIG_ZMK_SETTINGS_SAVE_DEBOUNC
1. Toggle backlight on/off
```
```dts
&bl BL_TOG
```
1. Sets a specific brightness
```
```dts
&bl BL_SET 50
```

View File

@@ -20,7 +20,7 @@ A ZMK device may show as "connected" on multiple hosts at the same time. This is
Bluetooth command defines are provided through the [`dt-bindings/zmk/bt.h`](https://github.com/zmkfirmware/zmk/blob/main/app/include/dt-bindings/zmk/bt.h) header,
which is added at the top of the keymap file:
```
```dts
#include <dt-bindings/zmk/bt.h>
```
@@ -54,25 +54,25 @@ The bluetooth behavior completes an bluetooth action given on press.
1. Behavior binding to clear the paired host for the selected profile:
```
```dts
&bt BT_CLR
```
1. Behavior binding to select the next profile:
```
```dts
&bt BT_NXT
```
1. Behavior binding to select the previous profile:
```
```dts
&bt BT_PRV
```
1. Behavior binding to select the 2nd profile (passed parameters are [zero based](https://en.wikipedia.org/wiki/Zero-based_numbering)):
```
```dts
&bt BT_SEL 1
```

View File

@@ -15,7 +15,7 @@ The modifiers are applied only to to the alphabetic (`A` to `Z`) keycodes, to av
Example:
```
```dts
&caps_word
```
@@ -25,7 +25,7 @@ Example:
By default, the caps word will remain active when any alphanumeric character or underscore (`UNDERSCORE`), backspace (`BACKSPACE`), or delete (`DELETE`) characters are pressed. Any other non-modifier keycode sent will turn off caps word. If you would like to override this, you can set a new array of keys in the `continue-list` property in your keymap:
```
```dts
&caps_word {
continue-list = <UNDERSCORE MINUS>;
};
@@ -41,7 +41,7 @@ By default, the caps word will remain active when any alphanumeric character or
In addition, if you would like _multiple_ modifiers, instead of just `MOD_LSFT`, you can override the `mods` property:
```
```dts
&caps_word {
mods = <(MOD_LSFT | MOD_LALT)>;
};
@@ -57,7 +57,7 @@ In addition, if you would like _multiple_ modifiers, instead of just `MOD_LSFT`,
If you want to use multiple caps breaks with different codes to break the caps, you can add additional caps words instances to use in your keymap:
```
```dts
/ {
prog_caps: behavior_prog_caps_word {
compatible = "zmk,behavior-caps-word";

View File

@@ -55,7 +55,7 @@ If you press a tapped hold-tap again within `quick-tap-ms` milliseconds of the f
For example, the following hold-tap configuration enables `require-prior-idle-ms` with a 125 millisecond term, alongside `quick-tap-ms` with a 200 millisecond term.
```
```dts
rpi: require_prior_idle {
compatible = "zmk,behavior-hold-tap";
label = "REQUIRE_PRIOR_IDLE";
@@ -78,7 +78,7 @@ If `retro-tap` is enabled, the tap behavior is triggered when releasing the hold
For example, if you press `&mt LEFT_SHIFT A` and then release it without pressing another key, it will output `a`.
```
```dts
&mt {
retro-tap;
};
@@ -96,7 +96,7 @@ Note that `hold-trigger-key-positions` is an array of key position indexes. Key
See the following example, which uses a hold-tap behavior definition, configured with the `hold-preferred` flavor, and with positional hold-tap enabled:
```
```dts
#include <dt-bindings/zmk/keys.h>
#include <behaviors.dtsi>
@@ -141,7 +141,7 @@ The two parameters that are passed to the hold-tap in your keymap will be forwar
If you use behaviors that accept no parameters such as [mod-morphs](mod-morph.md) or [macros](macros.md), you can pass a dummy parameter value such as `0` to the hold-tap when you use it in your keymap.
For instance, a hold-tap with node label `caps` and `bindings = <&kp>, <&caps_word>;` can be used in the keymap as below to send the caps lock keycode on hold and invoke the [caps word behavior](caps-word.md) on tap:
```
```dts
&caps CAPS 0
```
@@ -166,7 +166,7 @@ The following are suggested hold-tap configurations that work well with home row
##### Option 1: cross-hand only modifiers, using `tap-unless-interrupted` and positional hold-tap (`hold-trigger-key-positions`)
```dtsi title="Homerow Mods: Cross-hand Example"
```dts title="Homerow Mods: Cross-hand Example"
#include <dt-bindings/zmk/keys.h>
#include <behaviors.dtsi>
@@ -198,7 +198,7 @@ The following are suggested hold-tap configurations that work well with home row
##### Option 2: `tap-preferred`
```dtsi title="Homerow Mods: Tap-Preferred Example"
```dts title="Homerow Mods: Tap-Preferred Example"
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
@@ -228,7 +228,7 @@ The following are suggested hold-tap configurations that work well with home row
##### Option 3: `balanced`
```dtsi title="Homerow Mods: Balanced Example"
```dts title="Homerow Mods: Balanced Example"
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
@@ -262,7 +262,7 @@ The following are suggested hold-tap configurations that work well with home row
A popular method of implementing Autoshift in ZMK involves a C-preprocessor macro, commonly defined as `AS(keycode)`. This macro applies the `LSHIFT` modifier to the specified `keycode` when `AS(keycode)` is held, and simply performs a [keypress](key-press.md), `&kp keycode`, when the `AS(keycode)` binding is tapped. This simplifies the use of Autoshift in a keymap, as the complete hold-tap bindings for each desired Autoshift key, as in `&as LS(<keycode 1>) <keycode 1> &as LS(<keycode 2>) <keycode 2> ... &as LS(<keycode n>) <keycode n>`, can be quite cumbersome to use when applied to a large portion of the keymap.
```dtsi title="Hold-Tap Example: Autoshift"
```dts title="Hold-Tap Example: Autoshift"
#include <dt-bindings/zmk/keys.h>
#include <behaviors.dtsi>
@@ -298,7 +298,7 @@ A popular method of implementing Autoshift in ZMK involves a C-preprocessor macr
This hold-tap example implements a [momentary-layer](layers.md/#momentary-layer) when the keybind is held and a [toggle-layer](layers.md/#toggle-layer) when it is tapped. Similar to the Autoshift and Sticky Hold use-cases, a `MO_TOG(layer)` macro is defined such that the `&mo` and `&tog` behaviors can target a single layer.
```dtsi title="Hold-Tap Example: Momentary layer on Hold, Toggle layer on Tap"
```dts title="Hold-Tap Example: Momentary layer on Hold, Toggle layer on Tap"
#include <dt-bindings/zmk/keys.h>
#include <behaviors.dtsi>

View File

@@ -27,7 +27,7 @@ To make it easier to encode the HID keycode numeric values, most keymaps include
the [`dt-bindings/zmk/keys.h`](https://github.com/zmkfirmware/zmk/blob/main/app/include/dt-bindings/zmk/keys.h) header
provided by ZMK near the top:
```
```dts
#include <dt-bindings/zmk/keys.h>
```
@@ -44,6 +44,6 @@ The "key press" behavior sends standard keycodes on press/release.
Example:
```
```dts
&kp A
```

View File

@@ -13,7 +13,7 @@ The key repeat behavior when triggered will send whatever keycode was last sent/
Example:
```
```dts
&key_repeat
```
@@ -25,7 +25,7 @@ By default, the key repeat will only track the last pressed key from the HID "Ke
If you'd rather have the repeat also capture and send Consumer page usages, you can update the existing behavior:
```
```dts
&key_repeat {
usage-pages = <HID_USAGE_KEY HID_USAGE_CONSUMER>;
};

View File

@@ -18,7 +18,7 @@ Example uses for key toggle include shift lock, or `ALT-TAB` window switching wi
Example:
```
```dts
&kt LALT
```

View File

@@ -16,7 +16,7 @@ add a set of `#define`s at the top of your keymap file, and use those layer in y
For example, if you have three layers, you can add the following to the top of your keymap:
```
```dts
#define DEFAULT 0
#define LOWER 1
#define RAISE 2
@@ -37,7 +37,7 @@ again.
Example:
```
```dts
&mo LOWER
```
@@ -53,7 +53,7 @@ The "layer-tap" behavior enables a layer when a key is held, and outputs a [keyp
Example:
```
```dts
&lt LOWER SPACE
```
@@ -61,7 +61,7 @@ Example:
You can configure a different tapping term or tweak other properties noted in the [hold-tap](hold-tap.md#advanced-configuration) documentation page in your keymap:
```
```dts
&lt {
tapping-term-ms = <200>;
};
@@ -93,7 +93,7 @@ The "to layer" behavior enables a layer and disables _all_ other layers _except_
Example:
```
```dts
&to 3
```
@@ -108,13 +108,13 @@ The "toggle layer" behavior enables a layer until the layer is manually disabled
Example:
```
```dts
&tog LOWER
```
"Toggle layer" for a :
```
```dts
#define DEFAULT 0
#define NAVI 1

View File

@@ -14,7 +14,7 @@ Each macro you want to use in your keymap gets defined first, then bound in your
A macro definition looks like:
```
```dts
/ {
macros {
zed_em_kay: zed_em_kay {
@@ -38,7 +38,7 @@ used to reference the macro in your keymap.
The macro can then be bound in your keymap by referencing it by the label `&zed_em_kay`, e.g.:
```
```dts
raise_layer {
bindings = <&zed_em_kay>;
};
@@ -54,7 +54,7 @@ with [modifier functions](../codes/modifiers.mdx#modifier-functions) can be used
Like [hold-taps](/docs/behaviors/hold-tap), macros are created by composing other behaviors, and any of those behaviors can
be added to the `bindings` list, e.g.:
```
```dts
bindings
= <&to 1>
, <&bl BL_ON>
@@ -86,7 +86,7 @@ To modify the activation mode, macro controls can be added at any point in the `
A concrete example, used to hold a modifier, tap multiple keys, then release the modifier, would look like:
```
```dts
bindings
= <&macro_press &kp LSHFT>
, <&macro_tap &kp Z &kp M &kp K>
@@ -101,7 +101,7 @@ the macro itself is released.
To pause the macro until release, use `&macro_pause_for_release`. For example, this macro will press a modifier and activate a layer when the macro is pressed. Once the macro is released, it will release the modifier and deactivate the layer by releasing the `&mo`:
```
```dts
bindings
= <&macro_press &mo 1 &kp LSHFT>
, <&macro_pause_for_release>
@@ -116,7 +116,7 @@ which is equal to the value of [`CONFIG_ZMK_MACRO_DEFAULT_WAIT_MS`](../config/be
be set by assigning a value to the `wait-ms` property of the macro, e.g. `wait-ms = <20>;`. If you want to update the wait time at any
point in the macro bindings list, use `&macro_wait_time`, e.g. `&macro_wait_time 30`. A full example:
```
```dts
wait-ms = <10>;
bindings
= <&kp F &kp A &kp S &kp T>
@@ -132,7 +132,7 @@ which is equal to the value of [`CONFIG_ZMK_MACRO_DEFAULT_TAP_MS`](../config/beh
be set by assigning a value to the `tap-ms` property of the macro, e.g. `tap-ms = <20>;`. If you want to update the tap time at any
point in a macro bindings list, use `&macro_tap_time`, e.g. `&macro_tap_time 30`. A full example:
```
```dts
bindings
= <&macro_tap_time 10>
, <&kp S &kp H &kp O &kp R &kp T>
@@ -153,7 +153,7 @@ Another limit worth noting is that the maximum number of bindings you can pass t
Macros can also be "parameterized", allowing them to be bound in your keymap with unique values passed into them, e.g.:
```
```dts
raise_layer {
bindings = <&my_one_param_macro A>
};
@@ -262,7 +262,7 @@ lm: lm {
To trigger a different underglow when the macro is pressed, and when it is released, we use the macro "press" activation mode whenever triggering the `&rgb_ug` behavior:
```
```dts
wait-ms = <0>;
tap-ms = <0>;
bindings
@@ -278,7 +278,7 @@ bindings
The other common use case for macros is to sending sequences of keycodes to the connected host. Here, a wait and tap time of at least 30ms is recommended to
avoid having HID notifications grouped at the BLE protocol level and then processed out of order:
```
```dts
wait-ms = <40>;
tap-ms = <40>;
bindings
@@ -292,7 +292,7 @@ bindings
Many operating systems allow a special sequence to input unicode characters, e.g. [Windows alt codes](https://support.microsoft.com/en-us/office/insert-ascii-or-unicode-latin-based-symbols-and-characters-d13f58d3-7bcb-44a7-a4d5-972ee12e50e0). You can use macros to automate inputting the sequences, e.g. below macro inserts `£` on Windows:
```
```dts
wait-ms = <40>;
tap-ms = <40>;
bindings
@@ -306,7 +306,7 @@ bindings
To avoid repetition or possible typos when declaring a **zero parameter macro**, a convenience _C_ macro, named `ZMK_MACRO(name, props)` can be used to simplify things:
```
```dts
ZMK_MACRO(my_zero_param_macro,
wait-ms = <30>;
tap-ms = <40>;
@@ -320,7 +320,7 @@ To avoid repetition or possible typos when declaring a **zero parameter macro**,
This can be used instead of a complete macro definition. During the firmware build process, the example above would produce the complete macro definition below:
```
```dts
my_zero_param_macro: my_zero_param_macro {
compatible = "zmk,behavior-macro";
label = "ZM_my_macro";

View File

@@ -21,7 +21,7 @@ passed down to the next active layer in the stack.
Example:
```
```dts
&trans
```
@@ -37,6 +37,6 @@ be passed down to the next active layer in the stack.
Example:
```
```dts
&none
```

View File

@@ -18,7 +18,7 @@ The Mod-Morph behavior acts as one of two keycodes, depending on if the required
An example of how to implement the mod-morph "Grave Escape":
```
```dts
/ {
behaviors {
gresc: grave_escape {
@@ -41,7 +41,7 @@ Note that this specific mod-morph exists in ZMK by default using code `&gresc`.
Example:
```
```dts
&gresc
```
@@ -62,7 +62,7 @@ Available Modifiers:
Example:
```
```dts
mods = <(MOD_LGUI|MOD_LSFT|MOD_RGUI|MOD_RSFT)>;
```
@@ -74,7 +74,7 @@ When a modifier specified in `mods` is being held, it won't be sent along with t
For example, the following configuration morphs `LEFT_SHIFT` + `BACKSPACE` into `DELETE`, and morphs `RIGHT_SHIFT` + `BACKSPACE` into `RIGHT_SHIFT` + `DELETE`.
```
```dts
/ {
behaviors {
bspc_del: backspace_delete {

View File

@@ -24,7 +24,7 @@ The Mod-Tap behavior either acts as a held modifier, or as a tapped keycode.
Example:
```
```dts
&mt LSHIFT A
```
@@ -32,7 +32,7 @@ Example:
You can configure a different tapping term in your keymap:
```
```dts
&mt {
tapping-term-ms = <400>;
};

View File

@@ -23,7 +23,7 @@ to select the BLE output through below behavior to be able to send keystrokes to
Output command defines are provided through the [`dt-bindings/zmk/outputs.h`](https://github.com/zmkfirmware/zmk/blob/main/app/include/dt-bindings/zmk/outputs.h)
header, which is added at the top of the keymap file:
```
```dts
#include <dt-bindings/zmk/outputs.h>
```
@@ -53,18 +53,18 @@ However it will only be saved after [`CONFIG_ZMK_SETTINGS_SAVE_DEBOUNCE`](../con
1. Behavior binding to prefer sending keyboard output to USB
```
```dts
&out OUT_USB
```
1. Behavior binding to prefer sending keyboard output to the current bluetooth profile
```
```dts
&out OUT_BLE
```
1. Behavior binding to toggle between preferring USB and BLE
```
```dts
&out OUT_TOG
```

View File

@@ -24,7 +24,7 @@ The following boards currently support this feature:
External power control command defines are provided through the [`dt-bindings/zmk/ext_power.h`](https://github.com/zmkfirmware/zmk/blob/main/app/include/dt-bindings/zmk/ext_power.h) header,
which is added at the top of the keymap file:
```
```dts
#include <dt-bindings/zmk/ext_power.h>
```
@@ -52,19 +52,19 @@ However it will only be saved after [`CONFIG_ZMK_SETTINGS_SAVE_DEBOUNCE`](../con
1. Behavior binding to enable the external power
```
```dts
&ext_power EP_ON
```
1. Behavior binding to disable the external power
```
```dts
&ext_power EP_OFF
```
1. Behavior binding to toggle the external power
```
```dts
&ext_power EP_TOG
```

View File

@@ -22,7 +22,7 @@ to the device
Example:
```
```dts
&sys_reset
```
@@ -38,7 +38,7 @@ you to flash a new firmware.
Example:
```
```dts
&bootloader
```

View File

@@ -19,7 +19,7 @@ The standard sensor rotation behavior allows fully binding behaviors to be invok
Here is an example that binds the [RGB Underglow Behavior](/docs/behaviors/underglow.md) to change the RGB brightness:
```
```dts
/ {
behaviors {
rgb_encoder: rgb_encoder {
@@ -55,7 +55,7 @@ Here is an example, showing how send key presses on rotation:
First, defining the sensor rotation itself, binding the [Key Press Behavior](/docs/behaviors/key-press.md) twice, then binding it in the `sensor-bindings` property of a keymap layer:
```
```dts
/ {
behaviors {
rot_kp: behavior_sensor_rotate_kp {

View File

@@ -14,13 +14,13 @@ A sticky key stays pressed until another key is pressed. It is often used for 's
Example:
```
```dts
&sk LSHIFT
```
You can use any keycode that works for `&kp` as parameter to `&sk`:
```
```dts
&sk LG(LS(LA(LCTRL)))
```
@@ -40,7 +40,7 @@ This setting is enabled by default. It ensures that if a sticky key modifier is
#### Example
```
```dts
&sk {
release-after-ms = <2000>;
quick-release;
@@ -56,7 +56,7 @@ This setting is enabled by default. It ensures that if a sticky key modifier is
This configuration would apply to all sticky keys. This may not be appropriate if using `quick-release` as you'll lose the ability to chain sticky key modifiers. A better approach for this use case would be to create a new behavior:
```
```dts
/ {
behaviors {
skq: sticky_key_quick_release {

View File

@@ -16,7 +16,7 @@ By default, sticky layers stay pressed for a second if you don't press any other
Example:
```
```dts
&sl 1
```
@@ -24,7 +24,7 @@ Example:
You can configure a different `release-after-ms` in your keymap:
```
```dts
&sl {
release-after-ms = <2000>;
};

View File

@@ -37,7 +37,7 @@ values={[
This example configures a tap-dance named `td0` that outputs the number of times its binding is pressed from 1-3.
```title="Basic Tap-Dance Example: Counter"
```dts title="Basic Tap-Dance Example: Counter"
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
@@ -78,7 +78,7 @@ Alphanumeric [`key press`](key-press.md) bindings, like those used for `td0`, wi
This example configures a mod-tap inside a tap-dance named `td_mt` that outputs `CAPSLOCK` on a single tap, `LSHIFT` on a single press and hold, and `LCTRL` when the tap-dance is pressed twice.
```title="Advanced Tap-Dance Example: Nested Mod-Tap"
```dts title="Advanced Tap-Dance Example: Nested Mod-Tap"
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>

View File

@@ -12,7 +12,7 @@ This page contains [RGB Underglow](../features/underglow.md) behaviors supported
RGB actions defines are provided through the [`dt-bindings/zmk/rgb.h`](https://github.com/zmkfirmware/zmk/blob/main/app/include/dt-bindings/zmk/rgb.h) header,
which is added at the top of the keymap file:
```
```dts
#include <dt-bindings/zmk/rgb.h>
```
@@ -65,13 +65,13 @@ However the settings will only be saved after [`CONFIG_ZMK_SETTINGS_SAVE_DEBOUNC
1. Toggle underglow on/off
```
```dts
&rgb_ug RGB_TOG
```
1. Set a specific HSB color (green)
```
```dts
&rgb_ug RGB_COLOR_HSB(128,100,100)
```