> It just would be a better one to write the custom-elements as wrappers for actual HTML elements.

pandoc has an extension for this:

https://pandoc.org/demo/example33/8.18-divs-and-spans.html

KeenWrite, my (R) Markdown editor, supports pandoc annotations:

https://youtu.be/7icc4oZB2I4?list=PLB-WIt1cZYLm1MMx2FBG9KWzP...

> Just like markdown requires some parser program to turn it in to HTML.

Or XHTML, which is XML, which can then be transformed into TeX macros, and then typeset into a PDF file with a theme (much like CSS stylizes HTML).

https://youtu.be/3QpX70O5S30?list=PLB-WIt1cZYLm1MMx2FBG9KWzP...

This allows separating content from presentation, allowing them to vary independently.