HTML allows referencing thousands of characters as
“named entities”,
short escape strings like &
that are replaced with single characters like &
.
These are heavily used for characters like &
, <
, and >
which have special meaning in HTML;
for international characters that are not possible to type directly on some keyboard layouts like é
;
and for other Unicode symbols that have never had dedicated keyboard keys like ∴
.
If you’re familiar with these shortcuts, it would be nice to be able to use them everywhere, not just in HTML but also in Word or Google Docs, or your text editor or IDE, or the terminal.
That’s where the open source text replacement package espanso comes in.
It allows you to define triggers like :date
, which are replaced in any text field with values of your choice like 20251706
.
Users also build packages of useful replacements,
and publish them on the espanso hub.
My new Named HTML Entities package
allows typing any named HTML entity with a :
prefix instead of &
,
and have it replaced with the Unicode character.
For instance:
Shortcut | Character | Unicode Name |
---|---|---|
:amp; |
& |
Ampersand |
:copy; |
© |
Copyright sign |
:mdash; |
— |
Em dash |
:hellip; |
… |
Horizontal ellipsis |
:infin; |
∞ |
Infinity |
:rarr; |
→ |
Rightwards arrow |
:larr; |
← |
Leftwards arrow |
:ne; |
≠ |
Not equal to |
:harr; |
↔ |
Left right arrow |
:spades; |
♠ |
Black spade suit |
:starf; |
★ |
Black star |
:there4; |
∴ |
Therefore |
:fnof; |
ƒ |
Latin small f with hook |
This includes unprintable Unicode characters —
a lot of fun can be had with
implicit directional marks
(shortcuts: :rlm;
and :lrm;
)
in URLs, Active Directory fields, source code files, and other contexts.
It supports every named entity maintained by the WHATWG — over two thousand of them.