WordPress.org

Ready to get started?Download WordPress

Forums

Markdown + <!--more--> renders invalid HTML (4 posts)

  1. kentl
    Member
    Posted 8 years ago #

    Hi!

    When I make posts I include <!--more--> at an appropriate position. When using Markdown to format my posts I have noticed that the current paragraph isn't terminated properly and has an abrupt ending at the position of the <!--more--> indicator.

    This results in invalid html with a which is never terminated.

    Is there any work around to solve this problem?

  2. kentl
    Member
    Posted 8 years ago #

    >This results in invalid html with a which is never terminated.
    This line should have been:
    This results in invalid html with a >p< which is never terminated.

    Reverse the direction of the >p< arrows (as I can't write the tag in this forum).

  3. MichelFortin
    Member
    Posted 8 years ago #

    Are you using the latest version of the Markdown plugin? I think this has been fixed in PHP Markdown 1.0.1.

    http://www.michelf.com/projects/php-markdown/

  4. jclark
    Member
    Posted 8 years ago #

    The original poster's issue appears to be resolved, although I'm experiencing a related issue with WP2.0 and PHP Markdown 1.0.1c... reference-style links defined at the end of the document don't work with <!--more--> if only the excerpt is showing. I'm not sure this is easily fixed without changing WP (but see below for workaround). Here's a sample Markdown post:

    blah blah blah [link][1] blah
    <!--more-->
    blah blah blah [other link][2]

    [1]: (link URI)
    [2]: (link URI)

    The problem is the the_content() (defined in wp-includes/template-functions-post.php) calls get_the_content(), which splits the original post if <!--more--> is present and there's more than one post on the current page. After getting back the top of the post from get_the_content(), the_content() then applies filters (including markdown).

    The workaround is to move any reference link definitions used before the <!--more-->, up before the <!--more-->. Like so:

    blah blah blah [link][1] blah

    [1]: (link URI)
    <!--more-->
    blah blah blah [other link][2]

    [2]: (link URI)

Topic Closed

This topic has been closed to new replies.

About this Topic