Question

Is there a way to strip HTML tags selectively in TextMate - you can easily do this in Dreamweaver. TextMate allows you to strip all HTML tags but I would like to get rid of only, let's say all the <span>'s and <font>'s.

On a similar topic, is there a way to get rid of all the inline css styles?

Was it helpful?

Solution

Why not use replace with regular expressions? E.g. to get rid of all inline css styles you would just replace

 style=".*"

with nothing (empty string). Note the leading space.

OTHER TIPS

Not that I'm aware of, but there's always the option of doing a Find/Replace for <span> (and </span>, obviously) and leaving the "Replace" field empty. Of course, this becomes a little more problematic if you've got spans with varying class/id attributes or what-have-you, then you're getting into RegExp territory.

That should at least give you a start, though. I'd be interested to hear what anyone else has to offer, though. Textmate is so customizable that I'm sure there's a better solution than what I've offered!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top