I'm working on email templates using web-mode
, which – alas – requires inline styling galore… many of my opening tags won't fit on a single line even on a 4K-Display due to the massive amount of Attributes.
In order to reduce the clutter when editing the content I would like to fold only the attributes of all HTML-tags. This could be achieved if there was a way to fold all strings matching the following regex: "[[:alnum:]]+=[^>]+"
or the first group of this one (probably safer): "<[[:alnum:]]+ +\\([^>]+\\)>"
.
By folding I basically mean hiding the text, possibly having it replaced by a clickable placeholder revealing it when clicked. AucTex does it like that.The replacement part is not necessary htough. Basically all I need is to temporarily get the clutter out of sight, e.g.:
<div class="someclass"> foo </div>
→ <div …> foo </div>
I've tried hs-mode
, but it seems to only operate on blocks, which won't work in my case since the Attributes are on the same line as the possible START and END regexes supposed to surround a block.
It should be possible to fold a regex, given the way e.g. AucTeX folds the content of certain macros etc. Any suggestions?
Many thanks in advance
Oliver