How can I remove certain HTML tags by name in Ruby?
For example:
string = "<!DOCTYPE html><html><body><h1>My First Heading</h1><p>My first paragraph.</p></body></html>"
string.magic_method("h1") #=> "<!DOCTYPE html><html><body><p>My first paragraph.</p></body></html>"
I wrote some regex to do this but wondered if there was a library or native method that could do the same thing.