How to use the linkifyjs/element function in linkifyjs

To help you get started, we’ve selected a few linkifyjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / linkifyjs / linkifyjs-tests.tsx View on Github external
describe("linkifyjs/element", () => {
    /**
     * The following tests were based on the documentation:
     * https://soapbox.github.io/linkifyjs/docs/linkify-element.html
     */
    const options: LinkifyOptions = {};
    const result1: HTMLElement = linkifyElement(document.body, options, document);
    const result2: HTMLElement = linkifyElement(document.body, options);
    const result3: HTMLElement = linkifyElement(document.body);
});
github DefinitelyTyped / DefinitelyTyped / types / linkifyjs / linkifyjs-tests.tsx View on Github external
describe("linkifyjs/element", () => {
    /**
     * The following tests were based on the documentation:
     * https://soapbox.github.io/linkifyjs/docs/linkify-element.html
     */
    const options: LinkifyOptions = {};
    const result1: HTMLElement = linkifyElement(document.body, options, document);
    const result2: HTMLElement = linkifyElement(document.body, options);
    const result3: HTMLElement = linkifyElement(document.body);
});
github DefinitelyTyped / DefinitelyTyped / types / linkifyjs / linkifyjs-tests.tsx View on Github external
describe("linkifyjs/element", () => {
    /**
     * The following tests were based on the documentation:
     * https://soapbox.github.io/linkifyjs/docs/linkify-element.html
     */
    const options: LinkifyOptions = {};
    const result1: HTMLElement = linkifyElement(document.body, options, document);
    const result2: HTMLElement = linkifyElement(document.body, options);
    const result3: HTMLElement = linkifyElement(document.body);
});
github plibither8 / refined-hacker-news / src / features / linkify-user-about.js View on Github external
function init(metadata) {
	const currentUser = document.querySelector('.hnuser').innerText;
	if (currentUser === metadata.user) {
		return false;
	}

	const infoTable = document.querySelector('table#hnmain').querySelectorAll('table')[1];
	for (const row of infoTable.querySelectorAll('tr')) {
		const headingsEl = row.querySelector('td');
		if (headingsEl.innerText === 'about:') {
			linkifyElement(headingsEl.nextElementSibling, {
				attributes: {
					rel: 'noopener'
				}
			});
		}
	}

	return true;
}
github FabricLabs / fabric / src / HtmlUtils.js View on Github external
export function linkifyElement(element, options = linkifyMatrix.options) {
    return _linkifyElement(element, options);
}
github iluminar / goodwork / resources / assets / js / bootstrap.js View on Github external
inserted: function (el) {
    linkifyElement(el, {
      className: 'text-blue-500',
      formatHref: function (href, type) {
        if (type === 'mention') {
          return window.location.origin + '/users' + href
        }
        return href
      }
    })
  }
})
github plibither8 / refined-hacker-news / src / features / show-item-info-on-hover.js View on Github external
${comments}
									${text}
								
							
						`;

						break;
					}

					default:
						break;
				}

				itemDiv.innerHTML = table;
				linkifyElement(itemDiv, linkifyOptions);
			}
		});
github plibither8 / refined-hacker-news / src / features / show-user-info-on-hover.js View on Github external
created:
								${renderedDate}
							
							
								karma:
								${userInfo.karma}
							
							${userInfo.about ? 'about:' + userInfo.about + '' : ''}
						
					
				`;

				userDiv.innerHTML = table;
				linkifyElement(userDiv, linkifyOptions);
			}
		});

linkifyjs

Find URLs, email addresses, #hashtags and @mentions in plain-text strings, then convert them into HTML <a> links.

MIT
Latest version published 18 days ago

Package Health Score

88 / 100
Full package analysis