Hi all! I’m having a problem with formatting (specifically superscript) disappearing when I paste content into the body of the snippet I’m creating.
My original content is in a google doc. I reached out to our TextExpander Account Manager and she emailed me something with a superscript. I WAS able to copy and paste that into the snippet body and keep the superscript. However, when I tried to email myself my source content I still lost the formatting when pasting from the email into the snippet body.
I’ve tried to copy from Microsoft word and TextEdit as well and am unable to get the formatting to stick. I’ve also tried adding HTML tags with no luck. I’m currently working in Rich Text content type. Does anybody have a fix for this or ideas of anything else I should try?
Thanks!
Hi @ElizabethVerh
I know it’s been a while but I just created a new snippet that I think will really help you out, and I wanted to share.
This JavaScript Snippet will allow you to type something like H2SO4, and it’ll expand as H₂SO₄. One snippet handles any compound this way, so you won’t need to build one per formula.
Here’s what to do 
- Create a new snippet and set the content type to JavaScript.
- Click the Fill-ins button in the editing bar → insert a Single Line Field → name it
Formula.
- Paste this script:
var formula = "%fill:Formula%";
var subs = {"0":"₀","1":"₁","2":"₂","3":"₃","4":"₄","5":"₅","6":"₆","7":"₇","8":"₈","9":"₉"};
formula.replace(/[0-9]/g, function(d){ return subs[d]; });
- Give it an abbreviation, like
;sub.
When you expand it, a box will pop up asking for “Formula” just type out what you need and just like that, you’re ready to go!
Let me know if you need any help
All the best,
-Nick