whitespace-se / storybook-addon-html

A Storybook addon that extracts and displays compiled syntax-highlighted HTML
Other
95 stars 44 forks source link

Add custom replacement option #81

Closed goofy-code closed 1 year ago

goofy-code commented 1 year ago

This option allows replacing any part of the code by providing one or multiple search patterns.

It would cover any need for cleaning code produced by various frameworks or internal stuff which shouldn't be exposed to the addon tab.

jeanfredrik commented 1 year ago

Nice idea! Would it make more sense to add a parameter like transform that just takes the HTML string and let's you transform it however you want by returning a new string? Then you could apply string replacements or even parse and traverse the HTML?

goofy-code commented 1 year ago

@jeanfredrik that's an even better idea ;-)

I've created a new PR for that: https://github.com/whitespace-se/storybook-addon-html/pull/83

81 can probably be closed as it's a lot of overhead compared to the transform approach.

jeanfredrik commented 1 year ago

Great, thank you!