✨ Preserve Perfect Formatting with This JavaScript + HTML Snippet Hack

Ever paste a beautifully crafted snippet into Word or Outlook, only to watch your formatting fall apart like a sad Jenga tower? :weary_face: We’ve got just the fix: a clever workaround using HTML and JavaScript that keeps your snippets looking crisp, clean, and exactly how you want them.

Whether you’re formatting an email signature, a branded response, or a super-styled list, this method ensures what you see is what you paste. Let’s do it! :rocket:


:test_tube: Step-by-Step: The Formatting Preservation Workflow

  1. Subscribe to the Preserve Formatting Snippet Group
    :backhand_index_pointing_right: Click here to subscribe
  2. Duplicate the Snippet Group This keeps the originals intact while giving you space to customize your own versions.
  3. Generate Your HTML You’ve got options here:
    • Use any online HTML generator — one we like is onlinehtmleditor.dev
    • Or save a Word document as HTML (filtered) to extract the code
  4. Paste Your HTML Into a Snippet
    • Open one of the HTML snippets you duplicated
    • Replace the placeholder content with your own HTML
    • Give it a new abbreviation to trigger it easily
  5. Update the JavaScript Snippet
    • Switch over to the jv.expandme snippet
    • Change the nested snippet abbreviation inside the script to match the new HTML snippet you just created
    • Give this JavaScript snippet a new abbreviation, too
  6. Test It Out! :test_tube:Expand the new abbreviation and marvel at your perfectly preserved formatting — no unexpected changes, no hassle, just clean results every time!

:movie_camera: Want to See It in Action?

We walk through the whole process in this quick video tutorial:

:backhand_index_pointing_right: Watch the full walkthrough here


This is one of those “once you try it, you’ll never go back” kinds of tricks. If you send a lot of polished, pre-formatted content, this will be your new favorite workflow. :love_letter:

4 Likes

I work here and even I didn’t know how to solve this. Thanks, Rex!

3 Likes

Haha, it’s a newer feature… isn’t it so handy?

2 Likes

I don’t know if I could love this any more than I do.

Literally just saved my brain when it comes to trying to get a heavily formatted template into Outlook emails.

If you want to add that note basically you have to have the email formatted in the way you want, and then switch the format text from rich text to HTML and then it will allow you to save it as an HTML file.

Then you can do the trick, but it also has all the nice things that come with having formatting the email in Outlook rather than the fun “bits” that are left over from Word when you paste it into an Outlook email.

4 Likes

Okay, after having used this for a bit my one complaint is that it really skews the reporting. Basically it acts like I’m inputting the HTML myself manually rather than copying and pasting just the text and I’ve got some skewed data.

Basically I have someone in the past month save 60 hours with 72 snippets because a lot of them were the large formatted HTML file that I’m using. We saved a lot of time with those, but that feels like it’s a little too much on the report side.

Hey @JonathanLavallee . This is likey do to the fact that our statistics don’t accurately track nested snippets currently. If you put your HTML content in with the JavaScript snippet, rather than having it as two snippets with one nested, it should more accurately reflect in statistics. I made the example with a nested snippet to make it easier to paste in the HTML. But you can totally just paste it where the nested snippet is instead. :slight_smile:

Please let me know if that helps. I’m happy to answer any questions you might have!

1 Like

I think you may have it backwards. It’s much higher than I think it should be rather than lower. :slight_smile:

And honestly the nested text is so much better and easier to parse and update that I wouldn’t change that for anything.

Ooooh, I follow. So statistics are reported based on the length of the text expanded by the WPM you enter in the form before generating the report. Unfortunately, I don’t think there is anything we can do to impact this based on how statistics are calculated. However, I can totally share this feedback with the team.

(I also like having the HTML nested, it just feels cleaner)

1 Like