markdown broken in forums

hi guys, there is some problem with markdown on this forums, before december 2016 image/file insert in markdown here was working perfectly, but now is broken. Example:


I was trying to use img in simple html as well but that does not work as well and even cannot be passed liek this: code. If you do it you will get this: <img src=""> (in raw post - dont even know if you can see it, i've posted img src html tag marked as code line but even that is removed for some reason.)

This is a quiet annoying. Why I am asking this? Basically its great to have images (screenshots) in forums, to provide users with some visual help as well - personally thinking, yes you can pass just link to image, but even me, on most forums wont click on image link. its 2017 and images should be displayed. You could force makrdown to phase links out to any image/file with https instead of http so it will not break down current encryption on your forums.

Or perhaps you could allow 2mb upload for files in forums (with jpg | jpeg | png | gif | txt | md extentions) - can this be somehow fixed please?

Many thanks.


Howdy -- thanks for your comments, I'll mention that to Joe.

It looks like attachments/uploads work for the initial post, but not for comments... I'm not whether that's intentional, or whether that's just Drupal being a little odd.

But Joe will be able to fill us in on that!

Assigned: Unassigned »
Status: Active » Needs work

Hi Eric, - thanks for mentioning this to admin (joe) - problem is serious as you can find out from my post - guys can you come back to me once it was fixed or perhaps - you would like to co-operate and I can fix issues like those with joe?


Joe's picture
Submitted by Joe on Tue, 01/10/2017 - 14:42 Pro Licensee

So, there are two issues here it sounds like (markdown for image links, and uploads of images)?

The markdown issue is new, and I know why it's happening...just not sure how to fix it.

The issue is with the order of processing text through the text filters in Drupal. It used to work because link conversion happened after markdown and wouldn't effect existing links. But...this led to links in forum posts and comments not having the rel="nofollow" attribute, which is disastrous in terms of being appealing to spammers. Switching the order of the filters fixed that problem, but apparently broke image links (I did some tweaks to fix regular links, though i don't remember what exactly). I'll spend some more time on the image links issue. Spam has been such a significant problem for the past several months that we definitely can't remove the url-to-link filter (as it add the rel="nofollow"), but maybe I can tweak the markdown filter to also do that, I dunno.

As for image upload not working on comments...that one is confusing. I dunno how uploads work in Drupal, as they're so inconsistent. There's like a dozen ways for files to be dealt with. But, i'm looking into it.

Images are definitely valuable! I'll figure out how to fix it.

Joe's picture
Submitted by Joe on Tue, 01/10/2017 - 15:18 Pro Licensee

This is an image!

This is a link!

And a link without markdown tags:

All working as expected now, I hope...

I tweaked the Markdown filter code to directly insert the rel="nofollow" everywhere. This is maybe suboptimal (when new versions of Markdown module or lib arrive, I'll have to do the same tweaks), but I think it works.

Joe's picture
Submitted by Joe on Tue, 01/10/2017 - 15:25 Pro Licensee

OK, image tags in markdown seem to be fixed. Now about comment file uploads..that one is confusing. comments and nodes are different entity types, and the comment_upload module doesn't exist for Drupal 7. I guess it's got fields, so I can probably add file fields to comments. Somehow.

I'll have to poke around some for that.

Joe's picture
Submitted by Joe on Tue, 01/10/2017 - 15:27 Pro Licensee

Oh poop. Link conversion still doesn't have rel="nofollow". Argh. I guess I need to either modify that module or turn it off.

Joe's picture
Submitted by Joe on Tue, 01/10/2017 - 16:01 Pro Licensee

OK, autolinking is fixed now, too.

Turns out it needed these changes:

Re-order the text filters to put "Limit allowed HTML" at the end, Markdown before "Convert URLs to links", and add img tags to the allowed tags in the "Limit allowed HTML" filter. Which actually fixes it better than my prior fix, as I don't have to worry about adding rel="nofollow" to upgraded Markdown modules in the future, as it's now automatic.

OK...still not sure about the file upload on comments thing, but Markdown image tags are working, without breaking rel="nofollow". Yay!

Joe's picture
Submitted by Joe on Tue, 01/10/2017 - 22:24 Pro Licensee

Status: Needs work » Fixed

OK, so comment file uploads is more trouble than I want to tackle right now, as it clutters up the UI in ugly ways that I don't see a good way to fix (and it's clumsy support, way to include the image inline in the message body, as can be done with Markdown or HTML). I'm gonna mark this completed.

If folks find it confusing to use Markdown images, I may rethink this position. But, cluttering up the UI with a file field that only gets used in a tiny percentage of posts seems like a poor trade off.

Hi Joe, thanks for fixing this. Regards the upload I was talking if markdown image attachments could not work - as an alternative. There is no need for uploads not at all as image in markdown works. THANKS YOU.