externalLinks()

Add rel and target attributes to external links in your Markdown output.

import { externalLinks } from "@unifast/node";

Signature

function externalLinks(options?: ExternalLinksPluginOptions): UnifastPlugin

Parameters

options?

Configuration for external link attributes

PropertyTypeDefaultDescription
relstring"nofollow noopener noreferrer"Value for the rel attribute on external links
targetstringValue for the target attribute (e.g., “_blank”)

Usage

import { compile, externalLinks } from "@unifast/node";

const result = compile(md, {
  plugins: [
    externalLinks({
      rel: "nofollow noopener noreferrer",
      target: "_blank",
    }),
  ],
});

Examples