better-html icon indicating copy to clipboard operation
better-html copied to clipboard

Add support to configure Parser

Open clinejj opened this issue 4 years ago • 0 comments

This is stemming from an issue running erb-lint on files with AlpineJS syntax (https://github.com/Shopify/erb-lint/issues/221), but it would be nice to add support to configure the parser to use some of the same configuration that better-html supports (in this case the partial_attribute_name_pattern would correct this). For example, being able to set config.partial_attribute_name_pattern = /\A[a-zA-Z0-9\-\:\@\.]+\z/ would allow for the following snippet to parse correctly:

<nav x-data="{ open: false }" @keydown.window.escape="open = false" class="bg-white border-b"></nav>

It looks like this might be a bit tricky given the underlying issue comes from the underlying html_tokenizer library.

clinejj avatar Jul 12 '21 14:07 clinejj