Importing a Mithril component in HTML doesn't make sense. Even if able to compile JSX in an HTML template, I don't think there's any way of registering components that way.
The best (and maybe only) way would be to use an extension, either via an actual extension designed for this or manual code in extend.php
.
If the component needs to be added before or after the HTML, it should be as easy as extending the page component and adding an item in a list. If there's no ItemList allowing easy insert, this could be PR'd to the page extension first.
If the component needs to be added in between HTML content, the easiest solution in my opinion would be to define a special token, like [discussions]
, then in the page template, split the HTML output, display each bit of HTML as HTML (like before) and replace the token with the component.
Other solutions could involve adding the same token or another syntax in the text formatter, then dig deeper into Mithril to register a component to use HTML root that's already written on the page. And I'm not even sure that's possible, because Mithril might refuse to interact with any HTML injected via the trusted HTML method. (edit: I realize, the text formatter might not be used at all if it's raw HTML)