WordPress.org

Ready to get started?Download WordPress

Forums

Markdown on Save Improved
Empty paragraphs around figure and figcaption tags (3 posts)

  1. Teo Dragovic
    Member
    Posted 9 months ago #

    Hi,

    I'm using WP 3.7.1 and MoSI 2.4.2 and have following code for outputing HTML5 tags when inserting images via Media Uploader:

    function html5_insert_image($html, $id, $caption, $title, $align, $url, $size, $alt) {
      $src  = wp_get_attachment_image_src( $id, $size, false );
      $html5 = "<figure>";
      $html5 .= "<img src='$src[0]' alt='$alt' />";
      if ($caption) {
        $html5 .= "<figcaption>$caption</figcaption>";
      }
      $html5 .= "</figure>";
      return $html5;
    }
    add_filter( 'image_send_to_editor', 'html5_insert_image', 10, 9 );

    but on publish my output code looks like this:

    <p></p>
    <figure>
    <img src="image_link" alt="alt_txt">
    <p></p>
    <figcaption>caption_txt</figcaption>
    <p></p>
    </figure>
    <p></p>

    If I put div around figure tags then there are no empty paragraphs but I'm wondering why figure and figcaption aren't recognized as block elements? Also, this doesn't happen with wp-markdown so it seems it's not markdown problem since both plugins use same parser.

    Any help is appreciated

    http://wordpress.org/plugins/markdown-on-save-improved/

  2. Chris Van Patten
    Member
    Posted 8 months ago #

    I'm also noticing issues with extra <p> tags around images with captions. I'm not using a <figure>/<figcaption> syntax though; just the standard <div>/<p>-based strucure.

  3. Ricard Torres
    Member
    Posted 7 months ago #

    Hi there,

    The first thing I've noticed when trying the plugin was the unnecessary <p>.

    I've tried: **this rocks**

    When I deactivate the plugin I get this in my editor (text tab):

    <p><strong>this rocks</strong></p>

    Shouldn't it just be <strong>this rocks</strong> ?

    Cheers.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.