Plugins

Autolinks

nizel-plugin-autolink configures Nizel’s built-in conversion of bare URLs and email addresses into links.

Install

npm install nizel-plugin-autolink

Usage

import { useNizel } from 'nizel';
import { autolinkPlugin } from 'nizel-plugin-autolink';

const nizel = useNizel({
  plugins: [
    autolinkPlugin({
      target: '_blank',
      rel: 'noopener noreferrer',
    }),
  ],
});

const html = await nizel.html('Visit https://example.com');

Options

Option Type Default Description
enabled boolean true Enables or disables autolinking.
target string - target attribute for generated links.
rel string - rel attribute for generated links.

Output

<p>Visit <a href="https://example.com" target="_blank" rel="noopener noreferrer">https://example.com</a></p>

Use this plugin when you want autolink behavior to be packaged and shared with the rest of your plugin setup.