-
Notifications
You must be signed in to change notification settings - Fork 45
Linkify URLs in annotations #156
Conversation
Not to nitpick too much, but linkify-it seems to have better support for autolinking text. Thinking about this post-React, this gets significantly easier (and safer) to do if the URLs can be provided as separate pieces of metadata. Is this something we could convert to? |
If annotation text is entirely an URL ( |
FWIW I gave linkifyjs a try with a sample url I had while testing #152 with more than one closing parenthesis and it didn't work as expected. I've reported the issue as nfrasser/linkifyjs#209 (see also markdown-it/linkify-it#23) though arguably it isn't something easily fixable or maybe in scope at all since the url I gave isn't url encoded anyway |
@filippog can you share an example that had this issue? Would be nice to add a test for it. |
@prymitive for sure! The link is sth like this:
|
fb81522
to
d3a838c
Compare
javascript-linkify seems to be the only module that handles kibana type links correctly, need to cleanup package-lock.json diff |
use linkifyjs to make all URLs in the annotation clickable, but since it requires us to stop escaping html when rendering annotation object let's first manually escape it to prevent rogue alerts with malicious annotations from executing <scripts> and other ugly things in user browsers
Help icon doesn't make sense for annotation key, info icon is a bit more related to the usage of annotations
Cleaned package-lock.json, diff is happy now |
Nice, thanks a lot! |
Right now we only convert annotations into links if the entire value is a link, this turns links inside annotation text into clickable hyperlinks.
Fixes #152