Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#2 | markdown-use-commonmark-parser-2332369-2.patch | 7.1 KB | ChrisSnyder |
Comments
Comment #1
ChrisSnyderThis project implements the CommonMark standard in php: https://github.com/colinodell/commonmark-php
Comment #2
ChrisSnyderThis is an initial attempt at using a the CommonMark standard by leveraging the commonmark-php library.
Comment #3
frjo CreditAttribution: frjo commentedCommonmark 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.
Comment #4
mikl CreditAttribution: mikl commentedWell, 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?
Comment #5
mikl CreditAttribution: mikl commentedComment #6
attiks CreditAttribution: attiks commentedWe 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.
Comment #7
donquixote CreditAttribution: donquixote commentedhttp://talk.commonmark.org/t/are-there-any-standards-compliant-php-imple...
Comment #8
anavarreComment #9
anavarrePer #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.
Comment #10
RobLoachA 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.
Comment #11
frjo CreditAttribution: frjo commentedI 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.
Comment #12
frjo CreditAttribution: frjo commentedComment #14
lpalgarvio CreditAttribution: lpalgarvio as a volunteer commentedGitHub has switched over to GFM with ComonMark.
Can we get this backported for Drupal 7?
Project page could use a description update as well.
Comment #15
lpalgarvio CreditAttribution: lpalgarvio as a volunteer commented