Since Markdown is now beeing standardised (http://spec.commonmark.org/), it would be wonderful if we could get a standards-compliant Markdown parser for this module.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ChrisSnyder’s picture

This project implements the CommonMark standard in php: https://github.com/colinodell/commonmark-php

ChrisSnyder’s picture

This is an initial attempt at using a the CommonMark standard by leveraging the commonmark-php library.

frjo’s picture

Commonmark is just yet another variant of Markdown. My goal for the D8 release is to make it easy to use more or less any Markdown PHP variant.

mikl’s picture

Commonmark is just yet another variant of Markdown.

Well, not really. Common Markdown is an attempt at making a standard, well documented implementation, and I think as such it would make a good default choice.

As for being able to use alternative implementations, I'm not sure I see that being a very common use case. Most people just want to install the Markdown module and have it work, not worry about what implementation to install. Have you had a lot of requests for this?

mikl’s picture

Issue summary: View changes
attiks’s picture

We needed this to be able to support responsive images while using markdown, in particular we needed this to be able to output a data attribute on an image tag, I wrote a short blog post describing how we did it, https://attiks.com/Zkt

Regarding the "standard" markdown, there is no such a thing, I admit it is a great initiative, but for the moment it is just another variant, most implementations have nice-to-have extras and I wonder if the "standard: one will add them all.

donquixote’s picture

anavarre’s picture

anavarre’s picture

Per #2191525: [PP-1][policy, no patch] Extend Markdown coding standards to support API module (DOXYGEN) Drupal's coding standards are likely going to embrace http://commonmark.org/ so this would make sense to go with the flow and have a common standard.

RobLoach’s picture

A better way around this would be to support both CommonMark and Markdown-php, but have a configuration option in the filter settings to select which processor to use.

frjo’s picture

Version: 7.x-2.x-dev » 8.x-1.x-dev
Status: Active » Needs review

I have now added an setting to Markdown filter to select between PHP Markdown and CommonMark to 8.x-1.x. Please install and test.

PHP Markdown can be installed either the old way in the libraries folder, you then need the libraries module for it to be loaded.

PHP Markdown and CommonMark can both be installed with composer and will then be autoloaded. (Composer is handy for developers but I don't really understand how others are supposed to do this. This seems to be the recommended way in Drupal 8 however.)

Any other markdown libraries we should add as options?

Happy to here suggestion for a better way to implement this.

frjo’s picture

Assigned: Unassigned » frjo
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

lpalgarvio’s picture

GitHub has switched over to GFM with ComonMark.

Can we get this backported for Drupal 7?

Project page could use a description update as well.

lpalgarvio’s picture

Version: 8.x-1.x-dev » 7.x-1.x-dev