Closed (works as designed)
Project:
Markdown
Version:
7.x-2.x-dev
Component:
Change to library
Priority:
Minor
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
5 Feb 2011 at 19:46 UTC
Updated:
20 Apr 2013 at 09:15 UTC
Jump to comment: Most recent file
Comments
Comment #1
betamos commentedSubscribing! And it should be in the filter settings.
(For some reason the built-in "convert line breaks..." seems to break Markdown, even though I tried different ordering.)
Comment #2
LarsKramer commentedAt GitHub they have changed some of Markdown's defaults, including the handling of single line breaks:
http://github.github.com/github-flavored-markdown/
Comment #3
kika commentedthis is very much needed, subsribing
Comment #4
danepowell commentedYeah this is pretty unintuitive for new users, and like you mentioned even advanced users can get bit by it too.
Comment #5
justin2pin commentedI completely agree that the usage for this is unintuitive, but this is upstream functionality and a part of the Markdown library itself. I've marked as postponed until the upstream code is addressed.
Comment #6
danepowell commentedWell since the upstream library appears to be pretty much unmaintained (I don't think the original library has been updated in 7 years!), maybe we should consider switching to the Github-maintained version, as mentioned in #2.
Comment #7
bartl commentedI just found this thread after a Google search because my colleague was complaining about the same thing...
I don't think this is easy to implement in the module, but the relevant snippet in the Github Flavored Markdown is this:
All it does is, for "simple lines" (whatever that means), replace single newlines with 2 spaces followed by a newline each, before passing it on to Markdown. Well, I can do that...
According to my tests, it does what it should do.
Comment #8
bartl commentedAfter I've implemented and used this on my own markdown rendering system, I noticed a bug: it puts a backslash in front of every apostrophe. Dynamic regexp replacements in PHP are tricky!
Changing the quote type in the replacement string (for eval) would appear to fix it (though I'm not sure it won't introduce yet another bug):
Comment #9
bartl commentedGrr, still not right! Now I get a backslash in front of the double quote.
The cause of my problem is that PHP inserts a backlash in front of single and of double quotes, before evaluating the code, but both
"\"\'"and'\"\''still contain a backslash, where the original string is"'. In other words: it's a result of a crappy design of preg_replace with //e, in PHP.Instead of trying to work around it, eventually I figured that using
preg_replace_callback, which doesn't have this problem, might be the best approach.So, this is the code I ended up with:
Comment #10
frjo commentedNo new development on the D6 branch.
Comment #11
js commentedHas the idea of fixing markdown been abandoned?
Just recently I have been using the online project management service at teamworkpm.net. They support markdown, which was great to see, but they enhanced markdown. I asked their support where the difference came from, and was told:
I would like to see the same functionality for Drupal -- somehow, and would be pleased to contribute a bit to help it happen.
Thanks, Jerry
Comment #12
js commentedPlease reopen this thread.
This:
http://meta.stackoverflow.com/questions/26011/should-the-markdown-render...
links to this:
http://daringfireball.net/linked/2009/10/23/github-flavored-markdown
which is a better version, but it inserts two
where one works better on teamworkpm.net.
Comment #13
frjo commentedIf someone can contribute a clean looking patch for this I will take a look.
A solution like in #9 would work I think. I will not start hacking the library.
Comment #14
barrapontoI guess our current code can work with a patched library, as long as you install it to sites/all/libraries. All you have to do is fork the official PHP Markdown repo. If there's anything that should be exposed from our side (such as the settings), patches welcome.
Comment #15
barrapontoBTW, Markdown is far from dead: last commit was today, 1.3 is closing to a release. http://michelf.ca/projects/php-markdown/
Instead of making the change in this module, please try contributing upstream.
Comment #16
betz commentedquick fix, but works.
Better would be to have a setting in the filter settings.
I post this as a reference.