Thursday, April 23, 2015

Redcarpet

Redcarpet is a Ruby library for rendering markup language.   When updating a CodePath Wiki guide entry, which hosts these documents outside of GitHub, I noticed that the list items not to be including the image tags that I used in a separate line:

1. Inside the Google Play Store for your project, navigate to `Settings` -> `API Access`:

    <img src="http://imgur.com/0n7ihzM.png"/>

I would see:

<ol>
<li>Inside the Google Play Store for your project, navigate to...
</ol>

<p><img src='http://imgur.com/0n7ihzM.png'/&amp></p&amp>


But if I added 4 spaces to the image tag, the problem went away:

1. Inside the Google Play Store for your project, navigate to `Settings` -> `API Access`:

        <img src="http://imgur.com/0n7ihzM.png"/>
 
Turns out that a change was made in Redcarpet v3.1.0 that changes the parsing behavior so that at least 4 spaces are needed for the line to be considered part of the list item.  It also is very likely that GitHub must be using an older version of this library, since this problem doesn't appear on native GitHub Wiki pages.   If GitHub should ever decide to upgrade to this new library, they're likely to cause their Wiki collection to experience similar problems!

https://github.com/vmg/redcarpet/commit/b7d5e017385a8ae35a594ff9535d31bd081ce973