Markdown not properly parsed for some files

There seems to be a problem with my configuration such that some posts (mostly older posts that have been migrated from a different platform) do not reliably get parsed into HTML. The post content shows raw markdown.

This can vary from one build to another, even when no changes are made. For example, I’ll issue a
jekyll build
and they are parsed as expected. I’ll make no changes and issue another
jekyll build
and they don’t get parsed.

They can be viewed here:

As an example, the complete contents of the .md for the first post on that page, “MAY IS OFFICIAL LISTERIA MONOCYTOGENES MONTH”, is:

---
title: May is Official Listeria Monocytogenes Month
layout: post
---

Okay, so perhaps not precisely the month of May, but starting in late April there’s been a spat of recalls attributable to Listeria in Canada and the United States. Looking at the CFIA recall listings for the first 10 days of May:

* [Food Recall Warning - Ajinomoto brand Yakitori Chicken with Japanese-Style Fried Rice recalled due to Listeria monocytogenes](http://www.inspection.gc.ca/about-the-cfia/newsroom/food-recall-warnings/complete-listing/2016-05-09b/eng/1462850202306/1462850205064)
* [Food Recall Warning - Harmonie brand, IGA brand, Co-op brand, Western Family brand and unbranded frozen vegetable products recalled due to Listeria monocytogenes](http://www.inspection.gc.ca/about-the-cfia/newsroom/food-recall-warnings/complete-listing/2016-05-07/eng/1462667105675/1462667109404)
* [Food Recall Warning - Cookin’ Greens Organic brand A Blend of Kale, Sweet Corn & Peas recalled due to Listeria monocytogenes](http://www.inspection.gc.ca/about-the-cfia/newsroom/food-recall-warnings/complete-listing/2016-05-06/eng/1462587217154/1462587221070)
* [Food Recall Warning - Stahlbush Island Farms brand Cut Green Beans recalled due to Listeria monocytogenes](http://www.inspection.gc.ca/about-the-cfia/newsroom/food-recall-warnings/complete-listing/2016-05-06/eng/1462593110816/1462593113719)

And if we look into the last week of April we also get:

* [Food Recall Warning – Organic by Nature brand frozen Organic Sweet Peas recalled due to Listeria monocytogenes](http://www.inspection.gc.ca/about-the-cfia/newsroom/food-recall-warnings/complete-listing/2016-04-23e/eng/1461458494788/1461458498163)

Needless to say, for the last two weeks Listeria has had a field day in Canada. The United States is not exempt! In what [Juska et al (2003)](http://link.springer.com/article/10.1023%2FA%3A1022416727626) refer to as the “amplification” of food safety threats, or what Stericycle call the [“multiplier effect”](http://www.stericycleexpertsolutions.com/multiplier-effect-strikes/), listeria contamination from SunOpta Inc., a sunflower seed supplier has [resulted in a massive cascade of recalls across the United States](http://www.foodsafetynews.com/2016/05/sunflower-seed-listeria-threat-causes-recalls-of-salad-trail-mix/).

This series of recalls includes Sunflower Seed Snacks, trail mix, protein bars, Brown and Haley Chocolate snacks, and perhaps most stunningly 17 tons of Trader Joe’s salad.

Similarly, frozen vegetables from CRF Foods in Pasco Washington were recalled on [April 23rd](http://www.fda.gov/Safety/Recalls/ucm497297.htm) and subsequently expanded on [May 2](http://www.fda.gov/Safety/Recalls/ucm498841.htm) to include over 42 brands and 358 products (notably, just in time for Listeria Month!)

It is rather stunning how far an error at a single supplier can reach in the contemporary food system. It almost seems as if we are reaching a level of consolidation and concentration in which the industry is too big to fail. The last two weeks has seen _tens of tons_ of food pulled from the market and destroyed as a result of mistakes made by only a few companies… and this is only the beginning of Listeria Month!

As you can see, many posts are afflicted with this, and as I said, it comes and goes between builds, even when no other changes are made to any file. I’m wondering if there’s some strange character encoding/escaping issue with one of these posts that migrated from a different platform?
Your suggestions welcomed, happy to provide any additional information.

Stupid question, but your source files are .md or .markdown right? They’re not .html?

Scratch that, I think the problem is likely your layout or an include.

For example on that link you shared above, post content/excerpt are fine on page 1. On page 2 it is outputting as raw Markdown.

If you click through any of those to the actual post they’re fine.

Do you have a public repo with your layout/include source code? I’m fairly certain your issue is in there.

Thanks for your response! Indeed they’re all .md.

here’s the contents on GitHub (I don’t host it there, I just version control it there):

Oops, sorry. Last commit didn’t make it to the GitHub servers. Hang on a sec.

Phew, minor OS X keychain issue prevented me from pushing to remote. Anyhow, https://github.com/scottisloud/rtt-jekyll is now updated.

Are you building with bundle exec jekyll build? If not give that a try. I just cloned your repo and built it locally and everything looks good to me.

If you don’t run the Jekyll commands through Bundler there’s a chance it uses older gems, which could explain why the Markdown isn’t being rendered in your site.paginator loop on pages 2 and up.

I think you’re onto something.

To date, most often the last build before uploading to the server would actually be generated by:

jekyll serve --incremental

(later with an update to jekyll I added --livereload)

Attempting to reproduce the issue, which is intermittent, I couldn’t reproduce it using

exec bundle jekyll build

but I was able to reproduce it at least once using

jekyll serve --incremental --livereload

When I then tried to reproduce the issue using: (dropping the --incremental and prefixing with the bundle exec)

bundle exec jekyll serve --livereload 

I have yet to reproduce the problem.

So I think it was either --incremental, loading old gems, or both, that were causing the issue.

I’ll see how it goes with the rejigged build and serve commands. Being intermittent it may still creep up.

cheers!

Could be a bug related to either --incremental or --livereload and the pagination plugins… as that’s where your problem is occurring.

I don’t use either of those flags when building so that could be why I didn’t see the problem when cloning your repo.

I’ll keep my eye on it. I think this has nailed my issue. If I don’t see it again after the changes to the commands and flags, then I’ll be fairly certain that it may be a bug.

thanks for your help!

Did this ever get resolved?

I just came across the same problem.

I was trying to write a page that would collect sections from all my posts and was running

jekyll serve --incremental --livereload

which gave me the pre-rendered markdown when I tried to use post.content . I finished writing the page and went to build the site, but the page no longer worked. I ended up figuring out that post.content was the post-rendered html, not the markdown that I had written the page for.

Working it out, it is only when I use jekyll serve with both --incremental and --livereload does post.content get the pre-rendered markdown.