imagifyjs? #423
Answered
by
nfrasser
skywalk1411
asked this question in
Q&A
imagifyjs?
#423
-
The same lib but for |
Beta Was this translation helpful? Give feedback.
Answered by
nfrasser
Jan 17, 2023
Replies: 2 comments 1 reply
-
Hi @skywalk1411, you can do this with a custom "Hello http://example.com/image.jpg".linkify({
render: ({ tagName, attributes, content }) => {
if (/\.(gif|jpe?g|png|svg)$/i.test(content)) {
// URL ends with image extension
return `<img src="${attributes.href}" />`
} else {
const attributeStr = "";
for (const attr in attributes) {
attributeStr += ` ${attr}=${attributes[attr]}`;
}
return `<${tagName}${attributeStr}>${content}</${tagName}>`;
}
},
}); |
Beta Was this translation helpful? Give feedback.
1 reply
-
@skywalk1411 please see the reference implementation here: |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
skywalk1411
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@skywalk1411 please see the reference implementation here:
https://github.com/Hypercontext/linkifyjs/blob/8951997c7cb36808c2017fdf13069ad4dea3dbae/packages/linkify-element/src/linkify-element.js#L97-L116