Open inkstak opened 1 year ago
Sorry for neglecting this for so long! I think this is a good feature, but I'm not keen on the class attributes. I think I'd prefer to have these as attributes of the particular instance of HtmlParser.
Perhaps the best implementation would be to expose the list of elements, and let you inject a parser, so that you could then subclass the parser with whatever elements you like. I'll think about it.
We use lookbook which relies on htmlbeautifier to output pretty HTML and we have some custom block elements (such as
<turbo-frame>
) which are not rendered indented.This PR replace the constants from
HtmlBeautifier::HtmlParser
by methods which allows to specify additional elements:The downside is that mappings is compiled each time HtmlParser is initialized. If this is an issue, I guess I can add a method to compile and cache the mappings only once.
I've add tests in a second commit but: