Support » Plugin: Gutenberg » Shortcode Block Can’t Do Shortcodes

  • Gutenberg includes a shortcode block, but it seems unable to cope with all but the simplest of shortcodes. I am using one that looks a lot like this.

    [myshortcode src="https:/my-image.jpg" caption="<a href='https://link-elsewhere'>Linked Text</a>"]

    But on saving, the shortcode block complains with “This block contains unexpected or invalid content”. When I hit the resolve button it highlights the single quotes in the shortcode in red and adds further double quotes around them.

    If I allow the resolve to go ahead, it replaces the shortcode block with paragraph block which displays the image and no caption. In other words it doesn’t interpret the shortcode properly.

    If I change the block to a custom HTML block, it changes the single quotes to double quotes on save. This causes the caption to not appear due to the syntax being invalid.

    If I escape the single quotes or use the ascii HTML entity value & # 39 ; then all manner of weirdness happens and I get variously the HTML itself displayed as a caption complete with & # 39 ; displayed, or no caption at all if I attempt to escape with a backslash.

    This has been an issue for ages. Please, please, please fix it.

  • The topic ‘Shortcode Block Can’t Do Shortcodes’ is closed to new replies.