A plugin utilizing HTML rendering

Hello, I'm trying to create an export plugin for Reveal.js (https://revealjs.com/) (HTML-based presentation tool).
However Reveal.js has some support for Markdown, I'd love to use Joplin renderer to produce a Reveal.js HTML Markup (https://revealjs.com/markup/) so that all cool features like Mermaid.js diagrams are working.

The exporter should

  1. run on one note,
  2. taking its markdown body, and splitting it by --- (<hr>) to get markdown slides
  3. render markdown for each slide to get content for <section> (Reveal.js slide boundry)
  4. pack all rendered HTML slides into one sldieshow HTML (with all CSS/JS links for Reveal.js and Joplin/plugins) + export resoruces (and fix links).

I've followed the json_exporter example, so I can figure out most points in the outlined flow above. The only missing one is point 3: how to render markdown in Joplin plugin (implementing ExportModule interface)?

So my question is: Is threre an elegant way to access joplin renderer within a plugin?

So far I was able to come up with only (theoretical) solution to bundle whole joplin-renderer npm package with plugin via webpack (somehow), which sounds to me a bit clumsy. Is there a better way?

Joplin uses a system of contentScripts to allow extending the renderer (and the editor). You should be able to use this to override the other renderer rules with one that shows your custom html instead.