The `vue-linkify` package provides a simple Vue.js directive (`v-linkified`) designed to automatically convert URLs and email addresses within plain text into clickable HTML `<a>` links. This package is built upon the core `linkifyjs` library. Last updated in December 2016 with version 1.0.1, it is primarily compatible with Vue.js 2.x applications and is considered abandoned. Due to its age, it does not support Vue 3.x and incorporates an older version of `linkifyjs`, lacking features and breaking changes introduced in more recent `linkifyjs` releases. Newer alternatives exist for Vue 3 environments.
npm install vue-linkifyVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to import and register the `v-linkified` directive globally in a Vue 2 application, applying it to HTML content with custom options.
For Vue 3 projects, consider alternatives like `vue-3-linkify` or `v-linkify` which are designed for Vue 3.
If modern `linkifyjs` features or security patches are required, it is recommended to use an actively maintained Vue wrapper or implement `linkifyjs` directly within a custom directive or component.
Always sanitize any user-generated or untrusted HTML content before binding it with `v-html`. Consider using a dedicated sanitization library.
Manually specify `target: '_blank'` and `rel: 'noopener noreferrer'` within the directive options if this behavior is desired for security best practices when opening links in new tabs. However, note that this package uses an older `linkifyjs` version so support for some `rel` attributes might be limited.
This package is for Vue 2.x. For Vue 3, you must use a Vue 3-compatible linkify directive, such as `vue-3-linkify` or `v-linkify`. Register it using `app.directive()` after creating the Vue app instance.