Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Differences in markdown parsers
  • I've been using the Markdown package in my project to do server-side parsing of user-generated-and-uploaded markdown. I noticed recently that the output wasn't matching what my client-side javascript markdown parser was outputting. Specifically, when making lists, if there was a single line-break before the first bullet, Markdown wasn't parsing it as a list (it requires an additional line break), while the javascript parser was (I'm using marked.js to provide immediate parsing and formatted previewing of user input). I rather like not needing a second line break before the actual list items, so I tried Parsedown - sure enough, it makes a list with just a single line break.

    Digging further though, it seems that the behavior of Markdown is more consistent with most other versions of markdown parsers, while Parsedown and marked.js aren't. In addition, Parsedown isn't documented on the fuelphp site (as far as I can tell), which makes me wonder if it will continue to be available in future versions.

    Would I be better off abandoning Parsedown in favor of Markdown? I'd be OK with this, it just means I need to find a different javascript implementation to use as well - consistency in the end result between the two is very important!
  • Afaik most of the Markdown implementations are based on John Grubers Mardown, which has been virtually unchanged since 2004, but know several additions, both public (like Markdown_Extra) and propriatary (like github flavoured markdown).

    Markdown is mentioned in the docs because it's used in the Parser package, but Fuel doesn't have a preference for one or the other.

    I can't say I never used any other version...
  • Thanks for the info. The reason I started using Parsedown in particular is that I noticed it was distributed with FuelPHP when I was browsing through the various directories. Yet it isn't mentioned in the docs online at all, which was sort of confusing. (Not a huge deal, I can read the source to figure out function signatures, etc., but it did make me wonder if it was intentionally included, and question whether it may disappear in future versions.)

    I think I'll stick with the combination of parsers I have now until something else happens to make me want to change...
  • Sorry?

    Afaik we used (up until 1.7.1) to distribute Michel Fortin's Markdown Extra, which is an extended version of the oriignal Markdown class from Daring Fireball. As of 1.7.2 (and in 1.8/dev) we switched to "michelf/php-markdown" composer package, which contains the same class.

    Where did you find something called Parsedown? I'm not aware something like that is in the framework, so that would explain why it's not documented. It should not be there?
  • Hmm.

    Well, now that I think of it, I downloaded the framework a few months ago then didn't do anything with it for a while. I don't actually recall if I got it directly from this site or a mirror somewhere - I downloaded it after reading a number of blogs that thought it was a good way to develop, I may have grabbed it from a link on one of those? Maybe it was added by that site/developer... That would certainly explain why it isn't documented here!

    Sorry for the confusion! I guess I've been using a bit of a non-standard version...
  • HarroHarro
    Accepted Answer
    No problem, glad we sorted out the confusion. ;)

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion