Last active
May 18, 2026 14:06
-
-
Save smeech/9003c0b7bd7a2d613321fa3c49e16b5c to your computer and use it in GitHub Desktop.
[Superscripts] #espanso #python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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