You could indeed make each header level its own node type, at which point it becomes easy to express this in the schema. Otherwise, yes, you can’t constraint attributes in the schema so you’ll have to script around that in your interface and maybe an appendTransaction hook to handle things like pasting.