Guys, did you find a solution for images in email notifications?
Is it related to this?NicolasSiver created this issue in NodeBB/NodeBB closed Email notifications: very big images #3717
Guys, I have problems with markdown plugin and feature:
Autoconvert url-like texts to links
This feature is very useful, and I would like to have it around. But It doesn't work well with another plugins...
I have tried priority higher than in markdown plugin (>5) But I still can see malformed html, like this:
I don't understand how, but
markdown plugin is able to change http urls...
<a href="<div class='videoWrapper'><iframe width='640' height='360' src='https://www.youtube.com/embed/mCp5As-Oo6E' frameborder='0' allowfullscreen></iframe></div>" rel="nofollow"></a>
How to omit this problem with post parsing?
Is it because of
filter:parse.raw? Is it fired always before
filter:parse.post? Should I use it also, if I want to be faster than
I'm not sure we use priority system in hooks anymore -- plugin ordering replaced that instead. I could be wrong though.
What kind of text are you detecting and replacing with?
As for raw vs post, raw is just used in post preview (and a couple other places). You should just replicate the same behaviour for both hooks. In the mentions plugin, I actually cheat a little bit and just call my parseRaw function and return it for calls to parse
@Nicolas Did you try a lower priority?
@baris yes, I have tried both, priority (4) and priority (8). Both provides inappropriate result.
@julian I also have changed order for the plugin, by placing it at top.
I'm working with URLs.
So basically when I swap URL, replacement can also contain URL.
For now, I see only one solution - disable Autoconvert of links in
markdown and ask plugin users to do the same...
Yes, but how is the link translated inappropriately?
Inappropriate result, not link
In both cases, low or high priority, replacement will be a href of the anchor tag or links in replacement will be anchor tags. (My code snippet in first post - first case).
Hmm... if your plugin sees unformatted urls (that is, no HTML), then your plugin hook is firing before Markdown, and you can modify the url as you see fit. Otherwise, it's after, and you'll need to send back the appropriate HTML.
However If you're seeing an unformatted URL and replace it with HTML, then markdown will sanitise the HTML for security purposes. Perhaps this is what is happening to you?
@julian Yes, Plugin sanitizes HTML, if I use higher priority than markdown plugin.
Actually It's sanitizes HTML and changes http urls on anchor tags, - double punch
If I use lower priority, I have my replacement as href property of anchor tag
I would like to find friendly way, so my plugin will work well with
And I don't like idea to extend my regular expressions to comply with anchor tags
@Nicolas What I mean to say is... don't send HTML into Markdown plugin, it'll sanitise it, which is likely not intended.
If you need to do more than replace the url, then unfortunately, you will have to alter the HTML after-the-fact
However, I recently had to mess around with it, so... here's a handy dandy regex for you to re-appropriate
/<a.+?href="(.+?)".*?>(.*?)<\/a>/g (matches all links)
@a_5mith that regex could help you too, if you want to modify your plugins to handle other arguments in the HTML string, like
@julian I don't like this idea, and situation in overall. Basically, It creates dependency in mine plugin to check if URLs were already changed, handle optional anchor tags, etc...
So, I will go with this:
@Nicolas wait, what are you trying to do? It looks like you're trying to convert a video link into an iframe tag, is that right?
@BDHarrington7 - https://github.com/NicolasSiver/nodebb-plugin-ns-embed
I'm working with different URLs to change them on HTML, most complex replacements will be iframes.
I have plans to release this plugin with:
@BDHarrington7 yes, I have checked them before I have started development
My YouTube plugin needs updating. But I'm in London tomorrow to Thursday. Then spending alternate weeks in gibraltar. So its hard to find the time.