Article summaries and blog.summary.separator producing malformed mark-up

I am having trouble generating article summaries using the blog.summary.separator. This is my first attempt with Middleman so no doubt it is a simple error on my part. No amount of DuckDuckGoing has helped me.

Setup

The blog.summary.separator is set in config.rb as:

blog.summary_separator = /(READMORE)/

The article markdown source file text is as follows:

Blog summary

READMORE

First paragraph.

Result

When I use article.body this source text generates:

<p>Blog summary.</p>

<p></p>

<p>First paragraph.</p>

When I use article.summary it generates:

<p>Blog summary.</p>

<p>

Why is it a problem?

I do not want the empty paragraph tag in the article body and as I am serving the built files using the application/xhtml+xml media type, I definitely do not want the un-closed paragraph in the article summary.

tl;dr Seems to be caused by Redcarpet

I’ve been having a similar issue, but in addition to blocks of markdown, seemingly random <p></p> tags were being wrapped around inline partials and, more strangely, around nearly every partial’s closing tag, but only partials within a loop. I initially thought the issue was caused by set :haml, { :ugly => true ... , since after setting :ugly to false it was fixed, but inline partials were still affected. I only considered a potential markdown cause by pure fluke after reading your question. I’ve removed Redcarpet and reverted back to Kramdown, and the issue has completely gone away.

I’m new to Middleman and most things here, so can’t give a reason, though I’m sure there probably is one…

Edit: should have read the date…

Never too late to share. I switched to putting the summary into the article’s front matter instead.