externalLinks()

Fügt externen Links in Ihrer Markdown-Ausgabe die Attribute rel und target hinzu.

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

Signatur

function externalLinks(options?: ExternalLinksPluginOptions): UnifastPlugin

Parameter

options?

Konfiguration für die Attribute externer Links

EigenschaftTypStandardBeschreibung
relstring"nofollow noopener noreferrer"Wert für das rel-Attribut externer Links
targetstringWert für das target-Attribut (z. B. “_blank”)

Verwendung

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

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

Beispiele