Reminds me of Edward Kmett's talks on monoidal parsing in which he has Dyck languages as an example.
I'm confused about the need for "linear types", unless you mean a monoid. I'm not sure of a use case where you would want a open fragment of html or a closed one other than to a have a hole, that is something like
f : HtmlBody -> HtmlBody
f x = someOpenFragment + x + someClosedFragment
The example in the reference in the piece is to have a header and a footer, where header would be open and footer closed.
As for linear types, I mean that somewhere the type system won't allow progress if you have an open type that wasn't converted to some final state. This is strictly necessary.
Ah, you don't need linear types for that. Linear types will prevent you from duplicating or discarding values, but all you need is to only allow "final state" values to be used in your API.
Also a reminder that I should read articles before commenting.