wp-shortcake / shortcake

Shortcake makes using WordPress shortcodes a piece of cake.
GNU General Public License v2.0
665 stars 143 forks source link

Escaping brackets in shortcode attribute does not work #779

Open montchr opened 6 years ago

montchr commented 6 years ago

We have a shortcode that needs to support brackets appearing in one of its attributes. The use case is for a pull quote with words in the quote paraphrased with brackets.

As mentioned in this Trac ticket from 10 years ago, brackets can be escaped by using double brackets [[ and ]]. This works in text mode of the editor, but upon switching to visual mode the shortcode terminates prematurely at the first appearance of ].

For example:

// Desired markup
[pullquote content="This is another way to integrate [the public library] into people's lives" align="right" credit="Community Health Librarian" /]

// Escaping markup
[pullquote content="This is another way to integrate [[the public library]] into people's lives" align="right" credit="Community Health Librarian" /]

// Resulting markup
[pullquote content="This is another way to integrate [[the public library]

] into people's lives" align="right" credit="Community Health Librarian" /]

We are using Shortcake Bakery to register this shortcode so it's possible the issue lies with that plugin and not this one.