Technically this is possible with a theme component that decorates posts, you would then define a [wrap] section for the embed and on post decoration load up the library and do the embedding stuff.
I would recommend quite a bit of caution here:
- You don’t want to invalidate your CSP, so you would have to consider this
- You do not want to slow down Discourse due to loading some big dynamic JS payload
- You are placing a lot of trust with runkit by allowing them to run JavaScript on your Discourse.
I would estimate building something here would take 1-2 days of work. If you have budget perhaps open a topic on marketplace ? Theme components can be installed fine on our business plan setups.