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

html attributes helper for value-less attributes

Open phantomwhale opened this issue 2 years ago • 0 comments

So I'm aware that you can do html_attributes("data-value": nil) if condition? to return "data-value" if the condition is truthy.

Is that the cleanest / only format? On reading the code, I briefly thought html_attributes("data-value") if condition? might work, but I overlooked the stringify_keys statement that means it needs to be a hash.

Would a PR to support strings, or arrays of strings, in the method be considered?

Or is this more a case of we've provided a basic clean interface to prevent too much magic producing bad HTML, so the preference is not sprinkle too much interface overloading magic in?!

phantomwhale avatar Aug 29 '23 07:08 phantomwhale