Custom DOM Serializer

Just write a nodeViews object that wraps the nodes that need to be compiled. You can use something like the function below as the nodeview constructor for such nodes (assuming they are leaf nodes).

function compiledView(node) {
  let {dom} = DOMSerializer.renderSpec(document, node.type.spec.toDOM(node))
  return {dom: $compile(dom)}
}