Skip to content

Commit 8091d53

Browse files
committed
docs: Reorganize and add ToC to README, add zkeymap
1 parent 7b3071d commit 8091d53

File tree

2 files changed

+46
-17
lines changed

2 files changed

+46
-17
lines changed

README.md

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,25 @@ See examples in [the live web demo](https://caksoylar.github.io/keymap-drawer) f
3030
Compared to to visual editors like [KLE](http://www.keyboard-layout-editor.com/), `keymap-drawer` takes a more programmatic approach.
3131
It also decouples the physical keyboard layout from the keymap (i.e., layer and combo definitions) and provides the tooling to bootstrap it quickly from existing firmware configuration.
3232

33+
## Table of Contents
34+
35+
- [Usage](#usage)
36+
* [Try it as a web application](#try-it-as-a-web-application)
37+
* [Command-line tool installation](#command-line-tool-installation)
38+
* [Bootstrapping your keymap representation](#bootstrapping-your-keymap-representation)
39+
* [Tweaking the produced keymap representation](#tweaking-the-produced-keymap-representation)
40+
* [Producing the SVG](#producing-the-svg)
41+
- [Customization](#customization)
42+
- [Miscellanea](#miscellanea)
43+
* [Custom SVG glyphs](#custom-svg-glyphs)
44+
* [Automated drawing workflow](#automated-drawing-workflow)
45+
- [Community](#community)
46+
* [Tools](#tools)
47+
* [Examples](#examples)
48+
* [Related projects](#related-projects)
49+
- [Development](#development)
50+
- [Questions? Feedback?](#questions-feedback)
51+
3352
## Usage
3453

3554
### Try it as a web application
@@ -155,7 +174,9 @@ KEYMAP_raw_binding_map='{"&bootloader": "BOOT"}' keymap parse -z zmk-config/conf
155174
Drawing parameters that are specified in the `draw_config` field can also be overridden in [the keymap YAML](KEYMAP_SPEC.md#draw_config).
156175
Using this you can preserve your style customizations along with your keymap in a single file.
157176

158-
## Custom SVG Glyphs
177+
## Miscellanea
178+
179+
### Custom SVG glyphs
159180

160181
`keymap-drawer` can also use SVG glyphs for legends, in addition to plain or unicode text. The easiest way to do this is
161182
to use the `$$source:id$$` notation [certain `source`s](CONFIGURATION.md#glyph_urls), which will automatically fetch
@@ -198,7 +219,7 @@ layers:
198219
- ["", "$$vol_up$$", "", "", ""]
199220
```
200221
201-
## Setting up an automated drawing workflow
222+
### Automated drawing workflow
202223
203224
If you use a [ZMK config repo](https://zmk.dev/docs/user-setup), you can set up an automated workflow that parses and draws your keymaps, then commits the YAML parse outputs and produced SVGs to your repo.
204225
To do that you can add a new workflow to your repo at `.github/workflows/draw-keymaps.yml` that refers to the reusable `keymap-drawer` [workflow](.github/workflows/draw-zmk.yml):
@@ -229,9 +250,10 @@ jobs:
229250
draw_args: "" # map of extra args to pass to `keymap draw`, e.g. "corne:'-k corne_rotated' cradio:'-k paroxysm'"
230251
```
231252
232-
### Modifying the workflow-generated commit
253+
#### Modifying the workflow-generated commit
233254
234-
The workflow will add the generated SVG and keymap representation YAML files to the `output_folder`, and generate a new commit with commit message "keymap-drawer render" by default. You can modify this commit message with the `commit_message` input param, e.g.:
255+
The workflow will add the generated SVG and keymap representation YAML files to the `output_folder`, and generate a new commit with commit message "keymap-drawer render" by default.
256+
You can modify this commit message with the `commit_message` input param, e.g.:
235257

236258
```yaml
237259
jobs:
@@ -243,7 +265,8 @@ jobs:
243265
# …other inputs
244266
```
245267

246-
Alternatively, you can choose to amend the triggering commit instead of generating a new one by using the `amend_commit: true` option. In this case the triggering commit's message will be used by default, and the `commit_message` input will be ignored. E.g.:
268+
Alternatively, you can choose to amend the triggering commit instead of generating a new one by using the `amend_commit: true` option.
269+
In this case the triggering commit's message will be used by default, and the `commit_message` input will be ignored. E.g.:
247270

248271
```yaml
249272
jobs:
@@ -256,7 +279,8 @@ jobs:
256279

257280
> #### ⚠️ Rewriting history
258281
>
259-
> You should understand the implications of rewriting history if you amend a commit that has already been published. See [remarks](https://git-scm.com/docs/git-rebase#_recovering_from_upstream_rebase) in `git-rebase` documentation.
282+
> You should understand the implications of rewriting history if you amend a commit that has already been published.
283+
> See [remarks](https://git-scm.com/docs/git-rebase#_recovering_from_upstream_rebase) in `git-rebase` documentation.
260284

261285
## Community
262286

@@ -267,6 +291,7 @@ Below are a few tools and example usages from the community that might be inspir
267291
- [YellowAfterlife's Vial To Keymap Drawer](https://yal-tools.github.io/vial-to-keymap-drawer/): Parser to convert Vial .vil files to keymap YAMLs
268292
- [jbarr21's `keymap-display`](https://github.com/jbarr21/keymap-display): Uses a [converter script](https://github.com/jbarr21/keymap-display/blob/main/scripts/json2yaml) to convert QMK `keymap.c` to a keymap YAML
269293
- [hnaderi's fork](https://github.com/hnaderi/keymap-drawer): Contains an example [Dockerfile](https://github.com/hnaderi/keymap-drawer/blob/main/Dockerfile) and publishes unofficial [Docker images](https://github.com/hnaderi/keymap-drawer/blob/main/README.md#using-docker)
294+
- [mnesarco's `zkeymap`)(https://github.com/mnesarco/zkeymap): Defines a DSL to generate ZMK keymaps, can also output `keymap-drawer` SVGs
270295

271296
### Examples
272297

@@ -281,6 +306,14 @@ Below are a few tools and example usages from the community that might be inspir
281306

282307
If you use `keymap-drawer`, tag your Github repo with the [`keymap-drawer` topic](https://github.com/topics/keymap-drawer) and it will show up for anyone else searching for it!
283308

309+
### Related projects
310+
311+
- [@nickcoutsos's ZMK keymap editor](https://github.com/nickcoutsos/keymap-editor)
312+
- [The original `keymap`](https://github.com/callum-oakley/keymap/)
313+
- [@jbarr21's keymap parser](https://github.com/jbarr21/keymap-display)
314+
- [@leiserfg's ZMK parser](https://github.com/leiserfg/zmk-config/tree/master/parser)
315+
- [Keymapviz](https://github.com/yskoht/keymapviz)
316+
284317
## Development
285318

286319
This project requires Python 3.12+ and uses [Poetry](https://python-poetry.org/) for packaging.
@@ -303,11 +336,3 @@ The source code for the Streamlit app lives in the [`keymap-drawer-web`](https:/
303336
## Questions? Feedback?
304337

305338
If you have any questions on usage or feedback for new or existing features, please check out the [Discussions tab](https://github.com/caksoylar/keymap-drawer/discussions) and feel free to create a new one!
306-
307-
## Related projects
308-
309-
- [@nickcoutsos's ZMK keymap editor](https://github.com/nickcoutsos/keymap-editor)
310-
- [The original `keymap`](https://github.com/callum-oakley/keymap/)
311-
- [@jbarr21's keymap parser](https://github.com/jbarr21/keymap-display)
312-
- [@leiserfg's ZMK parser](https://github.com/leiserfg/zmk-config/tree/master/parser)
313-
- [Keymapviz](https://github.com/yskoht/keymapviz)

resources/README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,21 @@ This folder contains resource/"data" files used by `keymap-drawer`. In particula
44

55
- [`zmk_keyboard_layouts.yaml`](zmk_keyboard_layouts.yaml): Contains a mapping of ZMK keyboard names (the part of the filename `<keyboard>.keymap`) to a mapping
66
of `physical-layout` to [physical layout specs](../PHYSICAL_LAYOUTS.md). For example:
7+
78
```yaml
89
planck:
9-
layout_grid_transform: {qmk_keyboard: planck/rev6, layout_name: LAYOUT_ortho_4x12}
10-
layout_mit_transform: {qmk_keyboard: planck/rev6, layout_name: LAYOUT_planck_1x2uC}
11-
layout_2x2u_transform: {qmk_keyboard: planck/rev6, layout_name: LAYOUT_planck_2x2u}
10+
layout_grid_transform: { qmk_keyboard: planck/rev6, layout_name: LAYOUT_ortho_4x12 }
11+
layout_mit_transform: { qmk_keyboard: planck/rev6, layout_name: LAYOUT_planck_1x2uC }
12+
layout_2x2u_transform: { qmk_keyboard: planck/rev6, layout_name: LAYOUT_planck_2x2u }
1213
```
14+
1315
Above maps each of the three physical layouts that are defined in the
1416
[ZMK `planck` config](https://github.com/zmkfirmware/zmk/blob/main/app/boards/arm/planck/planck_rev6.dts) to a corresponding QMK
1517
keyboard+layout.
1618

1719
When `keymap parse` parses a `planck.keymap`, it first searches for a ZMK physical layout (or matrix transform, for backwards compatibility)
1820
selected under a `chosen` node, e.g.:
21+
1922
```dts
2023
/ {
2124
chosen {
@@ -27,6 +30,7 @@ This folder contains resource/"data" files used by `keymap-drawer`. In particula
2730
...
2831
};
2932
```
33+
3034
Then it outputs the value corresponding to that keyboard/physical layout pair as the physical layout spec: `{zmk_keyboard: planck, layout_name: LAYOUT_ortho_4x12}`.
3135
If there is no layout selected in the keymap (which is the most frequent scenario), `layout_name` will be omitted.
3236

0 commit comments

Comments
 (0)