-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace calls to cheerio with a native JS implementation #321
Comments
Paging @psychobunny re: Question 1. |
I realize there was a comment about someone not liking it earlier, but its actually a pretty useful thing to have. Maybe not necessarily in the core though (or having the ability to switch on/off) Maybe the optimal thing to do is to replace the link upon saving, what do you think? |
That would be a good solution for me, but I am a huge fan of not mucking around with a user's post. In short, if I post something, then edit it, the raw text that is returned to me should be the exact same text that I input earlier, and altering the urls on-save would break this "rule" (note the quotes). How about this: We don't even bother changing the URL altogether (so if the user hovers over the url, it'll be the actual link), but we have some js on the client side:
In fact, I believe the basic code is already in ajaxify to detect if a |
Take a look at James Padolsey's Parsing URLs with the DOM!.
|
this is the route that seems the best, hope that's what you ended up doing:
|
Yeah, I just compare the domain (might have to check port too, now that I think about it) |
Every time we render a post (
postTools.toHTML
), we utilise cheerio to break down the fully rendered HTML into element objects, find the anchors, replace itshref
to send the user to that NodeBB's/outgoing
route, and then re-render the code again back into HTML.Cheerio, being a synchronous utility, is not the ideal solution for this.
Questions/Tasks
/outgoing
page, has it fallen out of favour?/outgoing
page be made a plugin instead?cheerio
with a native JS regexp implementationcheerio
as a dependencyThe text was updated successfully, but these errors were encountered: