Support » Plugin: Jetpack by WordPress.com » Excaping Shortcodes for Display Inside Markdown Code Block

  • Resolved Baden

    (@baden03)



    With out markdown, it’s very easy to escape a shortcode for display like so:
    <code>[[shortcode attribute="value"]content[/shortcode]]</code>

    However, this does not work when inside a markup code block using backticks:

    <ul>
        <li>item one</li>
        <li> item two [[shortcode attribute="value"]content[/shortcode]]</li>
        <li> item three</li>
    </ul>

    In the above example, the shortcode would have been processed although it is placed inside the markup code block. How can we display code blocks inside of markup with escaped shortcodes that are for display only?

    https://wordpress.org/plugins/jetpack/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    You do not need to add any code markup. As long as the shortcode is wrapped in square brackets, the shortcode should be displayed and not processed. This seems to work in my tests:

    <ul>
        <li>item one</li>
        <li> item two [[shortcode attribute="value"]content[/shortcode]]</li>
        <li> item three</li>
    </ul>
    - item one
    - item two [[shortcode attribute="value"]content[/shortcode]]
    - item three

    Could you give it a try, and let me know how it goes?

    The desired result in your example would be:

    - item one
    - item two [shortcode attribute="value"]content[/shortcode]
    - item three

    as:
    example: [[shortcode attribute="value"]content[/shortcode]]
    would render:
    example: [shortcode attribute="value"]content[/shortcode]

    But the good news is: We worked it out!

    Plugin Contributor Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    Right, that’s the results I get too, whether I use standard HTML to build my list (first example) or Markdown (Second example).

    Let me know if you have other questions!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Excaping Shortcodes for Display Inside Markdown Code Block’ is closed to new replies.