How should I decorate a leaf node like horizontal rule?

Taking horizontal rule as an example, if I try to decorate it by Decoration.widget, the decoration will never be applied into the leaf node since it can not have child nodes.

Should I allow the node to have child nodes or make it a customized nodeview?

Sometimes you can use a node decoration to add a class and then use :before/:after styles.

But yes, if you need dynamic nodes inside of the element, you’ll have to use a node view, since the inside of leaf nodes isn’t addressable in ProseMirror’s position system.