Right. Doable.
The best I have seen on this is @pmario’s Custom Markup.
It’s still in beta after some years. I’m not sure whether the approach is abandoned? @pmario?
IF it is still actively in development it would be well worth looking at.
TT