filter:post.parse and filter:post.parseSignature changes
-
@baris Not sure if related, but trying to update my youtube plugin to support the changes gives me infinite loop crash. Is fine when I disable the plugin again.
2014-11-08T12:40:21.717Z - [31merror[39m: /500 Error: Failed to lookup view "footer" in views directory "/home/a_5mith/35hz/public/templates" at EventEmitter.app.render (/home/a_5mith/35hz/node_modules/express/lib/application.js:519:17) at Object.async.parallel.footer (/home/a_5mith/35hz/src/middleware/middleware.js:225:8) at /home/a_5mith/35hz/node_modules/async/lib/async.js:583:25 at /home/a_5mith/35hz/node_modules/async/lib/async.js:125:13 at Array.forEach (native) at _each (/home/a_5mith/35hz/node_modules/async/lib/async.js:46:24) at Object.async.each (/home/a_5mith/35hz/node_modules/async/lib/async.js:124:9) at _parallel (/home/a_5mith/35hz/node_modules/async/lib/async.js:582:20) at Object.async.parallel (/home/a_5mith/35hz/node_modules/async/lib/async.js:598:9) at middleware.buildHeader (/home/a_5mith/35hz/src/middleware/middleware.js:220:8)
-
hey, it seems like this breaks plugins that might operate on links.
If its priority is too low, the html the plugin could output is escaped. If it is too high, the markdown auto-linkifier will run on the link which will feed our plugin some html where the original link would be.
-
@BDHarrington7 yeah, I'm trying to update his gfycat plugin to work. I have no idea how his youtube-lite plugin catches links before they're linkified, but this does not. It seems like they're functionally the same.
GitHub - dwendt/nodebb-plugin-gfycat: Embed gfycat videos into NodeBB
Embed gfycat videos into NodeBB. Contribute to dwendt/nodebb-plugin-gfycat development by creating an account on GitHub.
GitHub (github.com)
-
As far as I know, the functionality hasn't changed, it's just been renamed, and the arguments have been swapped around (that's what makes it a breaking change).
Markdown listens on priority 5, listen on 6 or 4 if you want to handle links before or after (though for the life of me I can't remember which is which).
Better bet would be to write a plugin for the underlying remarkable parser we use, although we don't have any examples of that yet...
-
@julian said:
Markdown listens on priority 5, listen on 6 or 4 if you want to handle links before or after (though for the life of me I can't remember which is which).
listening on a lower priority and adding HTML will result in the HTML being escaped by the markdown plugin on 5. listening on 5 or greater -- or not specifying a priority, results in your plugin seeing link HTML in many varied cases.
the issue is pretty much certainly not related to this thread though. youtube-lite seems to work fine, I'm sure there is some trick to this in there.
-
@dwn been meaning to look at that. accepting PRs.
The majority of my plugins don't use a priority, but do use callbacked:true. Unless there's some default behaviour when that happens, like only converting at the end for example, after markdown has parsed everything, I'm not sure. I'm not sure what made the gfycat plugin stop working. One day it worked, the next, less so.
-
@dwn I see your problem (although, I'm not sure why your plugin was working before, maybe the defaults changed on the markdown plugin, defaulting to linkifying urls where it wasn't before?). Anyway, the way @a_5mith and I are handling it is assuming the link to be wrapped in the anchor tag, and then parsing that out, running at a priority > 5. You can write your regex in a way that handles either case, but the trick you need to implement is to look for "<a href=" before the actual url.
Admittedly this is really hacky and we shouldn't be parsing html with regex in the first place, but that should get you up and running. If you need help, just ask, or take a look at the regex strings for youtube-lite or imgbed
If you do go this route, don't try to do it on priority < 5, as the markdown parser will escape the html if the setting for that is on (but you already knew that).
-
I've updated the plugin for 0.6.0, got it running, just need to diagnose why it's not working. It's getting to the winston warn about raw coming back as false. Not sure why. Will do some digging, see what I can pull out.
If anyone fancies taking a look at that, I'm pretty stumped.
30/11 16:34 [11326] - warn: Encountered an error parsing gfycat embed code, not continuing false This is the data: false [ undefined ]
-
What is the error?
else { winston.warn('Encountered an error parsing gfycat embed code, not continuing', raw); console.log('This is the data:', raw, gfycatinfo) callback(null, data); }
If it goes in there it means there is an error, try
console.log(err.stack);