Are you running this on your local machine? Do you have build-essentials installed?
Unsolved Parsing posts and markdown plugin with auto-linking
@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
markdownand 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:
- Disable Autoconvert for urls (Plugin's users will have to do the same)
- Use low priority
@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.