This sounds like a use case for Web Components, which lets JavaScript define a custom element and how to implement it.

Web Components must contain a hyphen, to disambiguate them from built-in elements, so you’d need to pick a tag like . Then your JavaScript library would be responsible for interpreting that element into normal elements in the shadow DOM.