There should be way to prevent WP from touching the content within a shortcode
|Reported by:||godfreykfc||Owned by:|
I fail. Reposted with proper formatting:
It is very furstrating now that "do_shortcode" is called after all the WP formatting stuff (e.g. wpautop, escaping html entities) because the content are usually messed up. There should be an option to get the RAW content.
Possible use cases:
- Create a [noformat]...noformat shortcode
- Create a [style]...style shortcode, which will put the content into a <style> element and inject it into the <head>
- Create a [markdown]...markdown shortcode, which formats the content with markdown
- Mini template language like the conditional custom fields shortcode plugin (or the php shortcode plugin)
Obviously, it is undesirable to have the content preformatted in either of the use cases listed above. For instance, in the CSS example, you'd have to go through the trouble of unescaping the HTML entities and then removing all the <br /> and <p> insterted by wpautop.
The trivial solution would be to put do_shortcode before the other formatting filters. However, this might have potential drawbacks too. For instance, the "unsafe" HTML inserted by the shortcode might get stripped too. (Which might or might not be a good thing). This enhancement obviously requries more thoughts so I'd like to see more disscusion of the potential advantages and disadvantages here.