node.js, ºê¶ó¿ìÀú , jQuery, Vanilla JavaScript, React.js, @mentions, #hashtag, ticket µîÀ» Áö¿øÇÕ´Ï´Ù.
±ÛÀ» ÀÛ¼ºÇÒ¶§ URL À» ÷ºÎÇϸé ÀÚµ¿À¸·Î ¸µÅ©°¡ »ý¼ºµÇ¸é ÁÁ°ÚÁö¸¸ ±×·¸Áö ¾Ê´Â °æ¿ì°¡ ´ëºÎºÐ ÀÔ´Ï´Ù.
±×·¡¼ º»¹®³»¿¡ ¸µÅ©°¡ ÀÖÀ» °æ¿ì URL ÁÖ¼Ò°¡ ÀÖÀ» °æ¿ì URL ¿¡ ÀÚµ¿À¸·Î ¸µÅ©¸¦ »ý¼º½ÃŰ´Â ¶óÀ̺귯¸® ÀÔ´Ï´Ù.
¸¸µé·Á°í ÇÏ¸é ¸¸µé°ÚÁö¸¸ ½±°Ô »ç¿ëÇÒ ¼ö ÀÖÀ¸´Ï »ç¿ëÇÏ´Â °Íµµ ±¦ÂúÀº °Í °°½À´Ï´Ù.
# »ç¿ë¹æ¹ý
1. Linkify ¶óÀ̺귯¸®¸¦ °¡Á®¿É´Ï´Ù.
<script src="linkify.js"></script>
<script src="linkify-html.min.js"></script>
<script src="linkify-element.js"></script>
2. ÅØ½ºÆ® ¿µ¾ïÀ» »ý¼º ÇÕ´Ï´Ù.
<div id="linkifyjs">
https://www.google.com <br>
https://www.naver.com <br>
https://www.daum.net <br>
https://www.nate.com <br>
https://www.yahoo.com <br>
https://www.bing.com <br>
https://www.ask.com <br>
https://www.duckduckgo.com <br>
admin@example.com <br>
</div>
3. DOM ¿ä¼Ò ³»ÀÇ ¸ðµç URL À» ¸µÅ©·Î º¯È¯ ÇÕ´Ï´Ù.
<script>
//linkifyElement(document.getElementById("id"), options, document);
linkifyElement(document.getElementById("linkifyjs"), {target: "_blank"});
</script>
4. »ç¿ë °¡´ÉÇÑ ¿É¼Ç
{
// additional attributes for the links
attributes: null,
// default CSS class
className: 'linkified',
// default protocol
defaultProtocol: 'http',
/* event listeners
click: function (e) {
alert('Link clicked!');
}
*/
events: null,
// format the text
format: function (value, type) {
return value;
},
// format the href
formatHref: function (href, type) {
return href;
},
// ignore specified HTML tags
ignoreTags: [],
// if true, \n line breaks will automatically be converted to <br> tags.
nl2br: false,
// rel attribute
rel: null,
// Accepts a function that takes the unformatted href, the link type (e.g., 'url', 'email', etc.) and returns the rel string.
// Accepts an object where each key is the link type and each value is the rel string to use for that type.
render: null,
// the tag that should be used to wrap each URL. This is useful for cases where a tags might be innapropriate, or might syntax problems
tagName: 'a',
// target attribute for each linkified tag.
target: {
url: '_blank'
},
// custom validation rules here
vali<a href="https://www.jqueryscript.net/time-clock/">date</a>: true,
// truncate link text
truncate: 0,
}
À§ÀÇ ±â´É ¿Ü¿¡µµ ¹®ÀÚ¿ÀÌ ¸µÅ©ÀÎÁö ¾Æ´ÑÁö Å×½ºÆ® ÇÏ´Â ±â´É, ip ÀÏ °æ¿ì ÇÁÅä·ÎÄÝ ºÙ¿©ÁÖ´Â ±â´É µî ... ¿©·¯°¡Áö ±â´ÉÀÌ Á¸ÀçÇÕ´Ï´Ù.
Çʿ信 µû¶ó¼ ÀûÀýÈ÷ »ç¿ëÇϸé ÁÁÀ» °Í °°½À´Ï´Ù.