Apply class to preview wrapper DIVs indicating element type

Use case or problem

I would like to add context-aware styling to my preview styles, for example:

h5 + h6 {
  margin-top: -0.9444444444rem;

This would allow utilizing CSS typography frameworks like

Proposed solution

I could see two approaches to enabling this.

  1. Don’t wrap preview elements in div tags
  2. Apply a class to the div tags indicating what the child element is. For example div.h1, div.table, etc…

Current workaround (optional)

I attempted to apply the classes myself using a plugin, but it looks like the preview pane is virtualized, so I can’t access all the elements when the preview loads.

Current workaround: