mdx_steroids.keys»
Note
This is a fork of pymdownx.keys
by Isaac Muse. Please check the documentation on the original author’s site!
Keys.
pymdownx.keys
Markdown extension for keystroke (user keyboard input) formatting.
It wraps the syntax ++key+key+key++
(for individual keystrokes with modifiers)
or ++"string"++
(for continuous keyboard input) into HTML <kbd>
elements.
If a key is found in the extension’s database, its <kbd>
element gets a matching class.
Common synonyms are included, e.g. ++pg-up++
will match as ++page-up++
.
Config»
If strict
is True
, the entire series of keystrokes is wrapped into an outer<kbd>
element, and then,
each keystroke is wrapped into a separate inner <kbd>
element, which matches the HTML5 spec.
If strict
is False
, an outer <span>
is used, which matches the practice on Github or StackOverflow.
The resulting <kbd>
elements are separated by separator
(+
by default, can be ''
or something else).
If camel_case
is True
, ++PageUp++
will match the same as ++page-up++
.
The database can be extended or modified with the key_map
dict.
Examples»
Input»
Press ++Shift+Alt+PgUp++, type in ++"Hello"++ and press ++Enter++.
Config 1»
pymdownx.keys:
camel_case: true
strict: false
separator: '+'
Output 1»
<p>Press <span class="keys"><kbd class="key-shift">Shift</kbd><span>+</span><kbd
class="key-alt">Alt</kbd><span>+</span><kbd class="key-page-up">Page Up</kbd></span>, type in <span
class="keys"><kbd>Hello</kbd></span> and press <span class="keys"><kbd class="key-enter">Enter</kbd></span>.</p>
Config 2»
pymdownx.keys:
camel_case: true
strict: true
separator: ''
Output 2»
<p>Press <kbd class="keys"><kbd class="key-shift">Shift</kbd><kbd class="key-alt">Alt</kbd><kbd
class="key-page-up">Page Up</kbd></kbd>, type in <kbd class="keys"><kbd>Hello</kbd></kbd> and press <kbd
class="keys"><kbd class="key-enter">Enter</kbd></kbd>.</p>
Idea by Adam Twardoch and coded by Isaac Muse.
Copyright © 2017 Isaac Muse isaacmuse@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the “Software”), to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
keystroke | result |
---|---|
click |
click |
double-click |
2×click |
drag |
drag |
drag-drop |
drag-drop |
menu-button |
☰ |
close-button |
✕ |
gear-button |
☼ |
update-button |
↻ |
auto-button |
♥ |
turn-on |
✓ |
turn-off |
□ |
mac |
<sup>M</sup> |
win |
<sup>W</sup> |
0 |
0 |
1 |
1 |
2 |
2 |
3 |
3 |
4 |
4 |
5 |
5 |
6 |
6 |
7 |
7 |
8 |
8 |
9 |
9 |
a |
A |
b |
B |
c |
C |
d |
D |
e |
E |
f |
F |
g |
G |
h |
H |
i |
I |
j |
J |
k |
K |
l |
L |
m |
M |
n |
N |
o |
O |
p |
P |
q |
Q |
r |
R |
s |
S |
t |
T |
u |
U |
v |
V |
w |
W |
x |
X |
y |
Y |
z |
Z |
space |
Space |
backslash |
\ |
bar |
| |
brace-left |
{ |
brace-right |
} |
bracket-left |
[ |
bracket-right |
] |
colon |
: |
comma |
, |
double-quote |
" |
equal |
= |
exclam |
! |
grave |
` |
greater |
> |
less |
< |
minus |
- |
period |
. |
plus |
+ |
question |
? |
semicolon |
; |
single-quote |
' |
slash |
/ |
tilde |
~ |
underscore |
_ |
arrow |
←↑↓→ |
arrow-up-down |
↑↓ |
arrow-left-right |
←→ |
arrow-up |
↑ |
arrow-down |
↓ |
arrow-left |
← |
arrow-right |
→ |
page-up |
PgUp |
page-down |
PgDn |
home |
Home |
end |
End |
backspace |
BkSp |
delete |
Del |
insert |
Ins |
tab |
⇥ |
break |
Break |
caps-lock |
CapsLock |
clear |
Clear |
eject |
Eject |
enter |
Enter |
escape |
Esc |
help |
Help |
print-screen |
PrtSc |
scroll-lock |
ScrLock |
num0 |
Num 0 |
num1 |
Num 1 |
num2 |
Num 2 |
num3 |
Num 3 |
num4 |
Num 4 |
num5 |
Num 5 |
num6 |
Num 6 |
num7 |
Num 7 |
num8 |
Num 8 |
num9 |
Num 9 |
num-asterisk |
Num * |
num-clear |
Num Clear |
num-delete |
Num Del |
num-equal |
Num = |
num-lock |
NumLock |
num-minus |
Num - |
num-plus |
Num + |
num-separator |
Num . |
num-slash |
Num / |
num-enter |
Num Enter |
alt |
Alt |
alt-graph |
AltGr |
command |
Cmd |
control |
Ctrl |
function |
Fn |
left-alt |
Left Alt |
left-control |
Left Ctrl |
left-meta |
Left Meta |
left-option |
Left Option |
left-shift |
Left Shift |
left-super |
Left Super |
left-windows |
Left Win |
meta |
Meta |
option |
Opt |
right-alt |
Right Alt |
right-command |
Right Command |
right-control |
Right Ctrl |
right-meta |
Right Meta |
right-option |
Right Option |
right-shift |
Right Shift |
right-super |
Right Super |
right-windows |
Right Win |
shift |
Shift |
super |
Super |
windows |
Win |
f1 |
F1 |
f2 |
F2 |
f3 |
F3 |
f4 |
F4 |
f5 |
F5 |
f6 |
F6 |
f7 |
F7 |
f8 |
F8 |
f9 |
F9 |
f10 |
F10 |
f11 |
F11 |
f12 |
F12 |
f13 |
F13 |
f14 |
F14 |
f15 |
F15 |
f16 |
F16 |
f17 |
F17 |
f18 |
F18 |
f19 |
F19 |
f20 |
F20 |
f21 |
F21 |
f22 |
F22 |
f23 |
F23 |
f24 |
F24 |
backtab |
Back Tab |
browser-back |
Browser Back |
browser-favorites |
Browser Favorites |
browser-forward |
Browser Forward |
browser-home |
Browser Home |
browser-refresh |
Browser Refresh |
browser-search |
Browser Search |
browser-stop |
Browser Stop |
context-menu |
Context Menu |
copy |
Copy |
mail |
|
media |
Media |
media-next-track |
Next Track |
media-pause |
Pause |
media-play |
Play |
media-play-pause |
Play/Pause |
media-prev-track |
Previous Track |
media-stop |
Stop |
print |
|
reset |
Reset |
select |
Select |
sleep |
Sleep |
volume-down |
Volume Down |
volume-mute |
Mute |
volume-up |
Volume Up |
zoom |
Zoom |
left-button |
Left Button |
middle-button |
Middle Button |
right-button |
Right Button |
x-button1 |
X Button 1 |
x-button2 |
X Button 2 |