Versatile html Shortcode Wrapper

Sometimes as I code a page I find it necessary to use some specific html to get the job done. the problem is that when I hand the site over to the client and they start editing in the Visual editor there is a danger that they will inadvertently over-write my html (which isn’t visible in the visual ecitor).

The answer is to use shortcode for html which shows up in the visual editor an kinda’ says “don’t touch”. So what I need is shortcode that is versatile and will produce nested, if necessary html. the code for the answer is below.

The shortcode by default produces a div the class “html_element”, but this can be over-ridden for instance this shortcode:

will produce:

I envision this being used for divs (default), spans, paragraph tags and h1, h2 … (image tags and links can be added and shown in the visual editor). This shortcode can also be nested up to four deep by adding “_inner” to each successive level. WordPress will not allow nesting a shortcode within itself see here.