Skip to content

Commit

Permalink
feat: format keyle.typ and bump to 0.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
magicwenli committed Aug 19, 2024
1 parent 71d80dd commit 4255d65
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 12 deletions.
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
# keyle

This package provides a simple way to style keyboard shortcuts in your documentation.
<p align="center">
<a href="https://github.com/magicwenli/keyle/blob/main/doc/keyle.pdf">
<img alt="Documentation" src="https://img.shields.io/website?down_message=offline&label=manual&up_color=007aff&up_message=online&url=https://github.com/magicwenli/keyle/blob/main/doc/keyle.pdf" />
</a>
<a href="https://github.com/magicwenli/keyle/blob/main/LICENSE">
<img alt="MIT License" src="https://img.shields.io/badge/license-MIT-brightgreen">
</a>
</p>

It was inspired by [auth0/kbd](https://auth0.github.io/kbd/) and [dogezen/badgery](https://github.com/dogezen/badgery).
A simple way to style keyboard shortcuts in your documentation.

Send them respect and love.
This package was inspired by [auth0/kbd](https://auth0.github.io/kbd/) and [dogezen/badgery](https://github.com/dogezen/badgery). Send them respect and love.

## Usage

Expand All @@ -13,7 +20,7 @@ Please see the [keyle.pdf](https://github.com/magicwenli/keyle/blob/main/doc/key
`keyle` is imported using:

```typst
#import "@preview/keyle:0.1.0"
#import "@preview/keyle:0.1.1"
```

### Example
Expand Down
Binary file modified doc/keyle.pdf
Binary file not shown.
37 changes: 30 additions & 7 deletions doc/keyle.typ
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ Generate a keyboard renderer with #cmdref("config") function. Section @available
#let kbd = keyle.config()
#kbd("Ctrl","Shift","Alt","Del")
#let kbd = keyle.config(theme: keyle.themes.biolinum, delim: keyle.biolinum-key.delim_plus)
#let kbd = keyle.config(
theme: keyle.themes.biolinum,
delim: keyle.biolinum-key.delim_plus
)
#kbd("Ctrl","Shift","Alt","Del")
```)

Expand Down Expand Up @@ -87,7 +90,15 @@ You can create your own theme by defining a function that takes a string and ret
stroke: rgb("#1c2024") + 0.3pt,
radius: 0.35em,
fill: rgb("#fcfcfd"),
text(fill: black, font: ("Segoe UI (Custom)","Roboto","Helvetica Neue","Open Sans (Custom)","sans-serif","Apple Color Emoji","Segoe UI Emoji"), content),
text(fill: black, font: (
"Segoe UI (Custom)",
"Roboto",
"Helvetica Neue",
"Open Sans (Custom)",
"sans-serif",
"Apple Color Emoji",
"Segoe UI Emoji"
), content),
),
)
#let kbd = keyle.config(theme: radix_kdb)
Expand All @@ -110,10 +121,17 @@ You can create your own theme by defining a function that takes a string and ret
"FiraCode",
"FiraCode Nerd Font Mono",
)
#grid(columns: (2fr, 1fr, 2fr, 1fr), rows: 2em,align: horizon, ..keyle.mac-key.pairs().map(item => (
#grid(
columns: (2fr, 1fr, 2fr, 1fr),
rows: 2em,
align: horizon,
..keyle.mac-key.pairs().map(item => (
raw("#keyle.mac-key." + item.at(0)),
kbd(text(font: mac-key-font, item.at(1))),
)).flatten())
kbd(
text(font: mac-key-font, item.at(1))
),
)).flatten()
)
```)

== Linux Biolinum Keyboard Symbols
Expand All @@ -124,10 +142,15 @@ You can create your own theme by defining a function that takes a string and ret

#example(```typst
#let kbd = keyle.config(theme: keyle.themes.biolinum)
#grid(columns: (5fr, 3fr, 5fr, 3fr), rows: 2em, align: horizon, ..keyle.biolinum-key.pairs().map(item => (
#grid(
columns: (5fr, 3fr, 5fr, 3fr),
rows: 2em,
align: horizon,
..keyle.biolinum-key.pairs().map(item => (
raw("#keyle.biolinum-key." + item.at(0)),
kbd(item.at(1)),
)).flatten())
)).flatten()
)
```)

= Available commands
Expand Down
2 changes: 1 addition & 1 deletion typst.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "keyle"
version = "0.1.0"
version = "0.1.1"
authors = ["magicwenli <yxnian@outlook.com>"]
license = "MIT"
description = "This package provides a simple way to style keyboard shortcuts in your documentation."
Expand Down

0 comments on commit 4255d65

Please sign in to comment.