Skip to content

Instantly share code, notes, and snippets.

@smeech
Last active May 18, 2026 14:06
Show Gist options
  • Select an option

  • Save smeech/9003c0b7bd7a2d613321fa3c49e16b5c to your computer and use it in GitHub Desktop.

Select an option

Save smeech/9003c0b7bd7a2d613321fa3c49e16b5c to your computer and use it in GitHub Desktop.
[Superscripts] #espanso #python
# Triggered by ":sup(some text)"
- regex: :sup\((?P<text>.+)\)
replace: "{{superscript}}"
vars:
- name: superscript
type: script
params:
args:
- python3
- -c
- |
sup = str.maketrans(
"0123456789abcdefghijklmnoprstuvwxyzABDEGHIJKLMNOPRTUVW+-=()",
"⁰¹²³⁴⁵⁶⁷⁸⁹ᵃᵇᶜᵈᵉᶠᵍʰⁱʲᵏˡᵐⁿᵒᵖʳˢᵗᵘᵛʷˣʸᶻᴬᴮᴰᴱᴳᴴᴵᴶᴷᴸᴹᴺᴼᴾᴿᵀᵁⱽᵂ⁺⁻⁼⁽⁾"
)
print("{{text}}".translate(sup))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment