Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: removal of attributes by regex #41

Open
certainlyakey opened this issue Feb 7, 2021 · 2 comments
Open

Feature request: removal of attributes by regex #41

certainlyakey opened this issue Feb 7, 2021 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@certainlyakey
Copy link

Thanks for a great (and greatly implemented) addon!

I have a request that will be familiar to anybody working with Angular. Angular adds a lot of attributes of its own into generated markup, like this:
image

Would it be possible to add a feature that would filter out an array of markup attributes by regex? So that we could strip out any attribute that begins from _ng or ng- and thus have a clean markup, leaving the Storybook consumers with all the parts that are really important.

@jeanfredrik
Copy link
Member

Sounds like a good idea. Depending on your reason for showing HTML to the user it would be nice to decide exactly what attributes to hide yourself, like you suggest. I think we should add a parameter that filters all attributes and that can be set to either a blacklist array of strings, a regex or a filter function (that could also receive the tag name and attribute value for more advanced filtering).

@jeanfredrik jeanfredrik self-assigned this Feb 8, 2021
@jeanfredrik jeanfredrik added the enhancement New feature or request label Feb 8, 2021
@certainlyakey
Copy link
Author

yes, that’s exactly what i meant 🙂 The regex feature for attribute names would be something that is definitely needed, since at least Angular generates quite random names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants