1. Add script tag at the top of the page

<script src="https://embed.runkit.com"></script>


  1. At the end add logic executes the script

Note: Add your custom node version nodeVersion: "14"

<script>
  class RunKitEmbed extends HTMLElement {
      constructor() {
          super();
          const wrapper = document.createElement('div')
          wrapper.style = "margin: 10pt"

          const source = this.textContent
          this.textContent = ""
          const tempCodePlaceholder = document.createElement('pre')
          tempCodePlaceholder.textContent = source

          window.RunKit.createNotebook({
              element: wrapper,
              source,
              onLoad: () => tempCodePlaceholder.remove(),
            gutterStyle: "inside",
            nodeVersion: "14"
          })
          this.appendChild(wrapper)
          this.appendChild(tempCodePlaceholder)
      }
  }
  customElements.define('rk-embed', RunKitEmbed);
</script>


  1. Final step wrap <rk-embed class="code">code</rk-embed> around your code 


<rk-embed class="code">
console.log("HelloWorld")
</rk-embed>