WordPress.org

Ready to get started?Download WordPress

Forums

WP-Markdown
Plugin breaks image captions when saving two times (2 posts)

  1. Jost0
    Member
    Posted 7 months ago #

    Hi!

    When I insert an image with caption and link, this shorttag is generated:

    [caption id="attachment_22" align="alignright" width="300"]<a href="image-url"><img src="thumbnailurl" alt="Test-Caption" width="300" height="199" class="size-medium wp-image-22" /></a> Test-Caption[/caption]

    When saving the post for the first time, the shorttag is changed to this:

    [caption id="attachment_22" align="alignright" width="300"][<img src="thumbnailurl" alt="Test-Caption" width="300" height="199" class="size-medium wp-image-22" />][1] Test-Caption[/caption]
    
    [...]
    
     [1]: imageurl

    This displays just fine. But when saving the same post again, this markdown is generated:

    [caption id="attachment_22" align="alignright" width="300"][<img src="thumbnailurl" alt="Test-Caption" width="300" height="199" class="size-medium wp-image-22" />][1][1] Test-Caption[/caption]
    
    [...]
    
     [1]: imageurl

    Notice the double [1][1] - The second [1] is inserted into the caption.

    Regards,
    Jost

    http://wordpress.org/plugins/wp-markdown/

  2. Grant Palin
    Member
    Posted 6 months ago #

    I've had the Markdown processor mess with my shortcodes too. Gets to be annoying sometimes. The author's recommended workaround is to wrap the shortcode in a div element, like so:

    <div>[caption id="attachment_22" align="alignright" width="300"]<a href="image-url"><img src="thumbnailurl" alt="Test-Caption" width="300" height="199" class="size-medium wp-image-22" /></a> Test-Caption[/caption]</div>

    As a rule, Markdown will not do anything inside block elements. So this simple workaround should prevent the processor from mucking around with your caption shortcodes.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.