I don't have anything for you that specifically works in HubSpot, although I know this has been done in the past. You could take a look into shortcode.js: https://github.com/nicinabox/shortcode.js. That's a bit older and you may need to adapt it a bit for HubSpot, but you could start there / see if it gives you any ideas.
If anyone else has done something similar though, feel free to chime in.