I think the most general way of doing this would be to have custom validation expressions in RichText.Model.ElementDefinition that would take in a node and return a list of validation errors if there were any.
validateNode : Node -> List String
But perhaps this is overkill, and creating something more specialized like content expressions would be easier for people to use, or more expressive for other things like defaulting behavior. In that case, perhaps having a content expression type that users implement for each element definition is the way to go.
See: https://discourse.elm-lang.org/t/a-toolkit-to-create-rich-text-editors-in-elm/5464/5?u=mweiss
I think the most general way of doing this would be to have custom validation expressions in
RichText.Model.ElementDefinition
that would take in a node and return a list of validation errors if there were any.But perhaps this is overkill, and creating something more specialized like content expressions would be easier for people to use, or more expressive for other things like defaulting behavior. In that case, perhaps having a content expression type that users implement for each element definition is the way to go.