An open API service indexing awesome lists of open source software.

https://github.com/masaki39/keymap-fetcher

A Vercel API that returns an SVG diagram of a MacBook Air 13" Japanese (JIS) keyboard with specified keys highlighted.
https://github.com/masaki39/keymap-fetcher

svg-api vercel-api

Last synced: about 2 months ago
JSON representation

A Vercel API that returns an SVG diagram of a MacBook Air 13" Japanese (JIS) keyboard with specified keys highlighted.

Awesome Lists containing this project

README

          

# keymap-fetcher

A Vercel API that returns an SVG diagram of a MacBook Air 13" Japanese (JIS) keyboard with specified keys highlighted. Primary use case: embedding keybinding diagrams in Markdown (GitHub READMEs, blogs).

## Demo

Base keyboard (no highlights):

![base keyboard](https://keymap-fetcher.vercel.app/api/keymap)

Vim motion keys (hjkl):

![hjkl](https://keymap-fetcher.vercel.app/api/keymap?keys=h,j,k,l)

Modifier keys:

![modifiers](https://keymap-fetcher.vercel.app/api/keymap?keys=ctrl,shift-l,cmd-r,opt)

## Usage

Embed in Markdown:

```markdown
![keymap](https://keymap-fetcher.vercel.app/api/keymap?keys=h,j,k,l)
```

Or with curl:

```sh
curl "https://keymap-fetcher.vercel.app/api/keymap?keys=h,j,k,l" -o keymap.svg
```

### Parameters

| Parameter | Description | Example |
|-----------|-------------|---------|
| `keys` | Comma-separated Vim key notation | `h,j,k,l` or `,` |

## Key Notation

Keys follow Vim conventions:

| Notation | Key |
|----------|-----|
| `a`–`z` | Letter keys |
| `1`–`0` | Number keys |
| `` | Escape |
| ``, ``, `` | Return/Enter |
| ``, ``, `` | Delete |
| `` | Tab |
| ``, `space` | Space bar |
| ``, `comma` | , (comma) |
| ``, ``, ``, `` | Arrow keys |
| ``–`` | Function keys |
| `` | Ctrl + x |
| `` | Shift + x |
| `` | Command (⌘) + x |
| ``, `` | Option (⌥) + x |
| `ctrl`, `shift`, `cmd`, `opt`, `alt`, `fn`, `caps` | Modifier keys alone |
| `shift-l`, `shift-r`, `cmd-l`, `cmd-r` | Shift/Command with side |
| `-`, `^`, `¥`, `@`, `[`, `;`, `:`, `]`, `.`, `/`, `_` | Symbol keys |

## Self-hosting on Vercel

```sh
git clone https://github.com/masaki39/keymap-fetcher.git
cd keymap-fetcher
npm install
vercel deploy
```

## Feedback

Please report issues at [GitHub Issues](https://github.com/masaki39/keymap-fetcher/issues).