Comments (10)
Yes, it should, but let me know if you find a situation where it doesn't.
from autolinker.js.
Think I'm running into a case where it's affecting manual links: http://www.wgxa.tv/story/mcdaniel-pleads-guilty-to-lauren-giddings-murder-20140421
About half way into the story there's a link: Download McDaniel's full confession, that's not clickable. The source code is correct: McDANIEL'S FULL CONFESSION --> Download McDaniel's full confession
The site is built on the dotCMS platform. The code I'm using to get the script to run is:
(script src="http://www.wgxa.tv/includes/js/Autolinker.min.js")
(/script)
(script)
$("#storyBody p").each(function() {
$(this).html(Autolinker.link($(this).text()));
});
(/script)
(tags were getting removed from comment)
If I remove the script from the page the link works as expected.
from autolinker.js.
Hey, so sorry for the late reply. Can you send the section of html that doesn't seem to be autolinked correctly? (or in this case, html that doesn't seem to be skipped over correctly?)
Thanks,
Greg
from autolinker.js.
No worries, I really appreciate your help with this. So here's a link to a page that works: http://www.wgxa.tv/story/man-fatally-shot-at-party-in-stone-mountain-20140505
Here's the page where the link was constructed correctly in our CMS, but no longer works once I activate Autolinker.js: http://www.wgxa.tv/story/mcdaniel-pleads-guilty-to-lauren-giddings-murder-20140421
The source for the section including the link:
McDANIEL'S FULL CONFESSION --> Download McDaniel's full confession.
Let me know if you need any more info from me! Thanks again.
from autolinker.js.
Hey, give it a try now with v0.9.1. The HTML parsing has been updated a bit, which might fix the issue.
If not, another thing that comes to mind is to make sure that you have valid markup relating to opening and closing <a> tags. Autolinker tries its best, but isn't a full HTML parser and might have trouble if there are <a> tags that aren't explicitly closed. (Which, as a side note, also made me start thinking about what to do with named anchors...).
Either way, let me know :)
from autolinker.js.
Thanks Greg, - trying it out now!
from autolinker.js.
Unfortunately no luck with the updated code. I started playing around with a few of the options in the script as well as turning off all other JS to make sure there wasn't a conflict somewhere. I noticed few things in my testing.
If the text is set to a URL instead of any anchor text, everything works as expected. Great! As soon as there's tags involved though, the link is broken (just like in our original example).
This was unexpected though: If I set urls : false in the script any text URLs are ignored, as expected, but any correctly coded URLs are still broken!
I thought maybe there was something else going on with another script that might be causing this, but I tested again after disabling all JS but Autolinker on the page and my download URL was still broken. If I disable Autolinker and reload the page the link works again.
from autolinker.js.
Hey cycology. I think I see the problem. You seem to be calling Autolinker by passing in the inner text of each of your <p> tags, rather than passing their inner html.
$("#storyBody p").each(function() {
$(this).html(Autolinker.link($(this).text()));
});
.text()
will return the contents of your <p> tags with all nested tags stripped, so your original tags would be gone before even calling Autolinker. You'll want to change that $(this).text()
to $(this).html()
Try that and let me know how it goes.
from autolinker.js.
Beautiful!
Thank you so much for your help with this!
On Thu, May 8, 2014 at 12:35 PM, Gregory Jacobs [email protected]:
Hey cycology. I think I see the problem. You seem to be calling Autolinker
by passing in the inner text of each of yourtags, rather than passing
their inner html.$("#storyBody p").each(function() {
$(this).html(Autolinker.link($(this).text()));});.text() will return the contents of your
tags with all nested tags
stripped, so your original tags would be gone before even calling
Autolinker. You'll want to change that$(this).text() to $ (this).html()Try that and let me know how it goes.
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/24#issuecomment-42572579
.
All my best,
-c
Chris Hood
478.954.0042 | c
www.chrislhood.com
from autolinker.js.
Awesome, glad it's working! Enjoy!
from autolinker.js.
Related Issues (20)
- 3 seconds to parse link in safari HOT 7
- Request: Add taiwanese style phone number format
- URL with multiple email addresses in query string is not linked correctly
- Autolinker vulnerable to RTLO URL spoofing attacks HOT 26
- Bug: getUrl method not working correctly for links in markdown formats HOT 1
- doc/release v3.16.0 changelog missing HOT 1
- urls.wwwMatches usecase HOT 4
- Links with `¬` in query string are broken
- encoded email address is split
- Wrong result when parsing CJK(中文/日文/韩文) char followed by colon HOT 1
- Failed to parse source map HOT 2
- Add support for YouTube hashtags HOT 1
- Add support for YouTube mentions HOT 1
- Url with protocol prefixed with emoji being incorrectly parsed HOT 1
- Help to create Markdown Link Matcher
- Enable `inlineSources`
- URL as value in key-value pair parsed only partially (and incorrectly)
- [Tiktok mentions] - parsing does not match tiktok mention behaviour HOT 2
- Detection If a Persian word is attached before the link
- Help fix
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from autolinker.js.