/** * Plugin to automatically add `target` and `rel` attributes to external links. * * @type {import('unified').Plugin<[Options?] | Array, Root>} */ export default function rehypeExternalLinks( options?: void | Options | undefined ): | void | import('unified').Transformer export type Root = import('hast').Root export type Properties = import('hast').Properties export type Element = import('hast').Element export type ElementChild = Element['children'][number] export type Target = '_self' | '_blank' | '_parent' | '_top' export type Rel = Array | string export type Protocols = Array export type Content = ElementChild | Array export type ContentProperties = Properties export type TargetCallback = (node: Element) => Target | null | undefined export type RelCallback = (node: Element) => Rel | null | undefined export type ProtocolsCallback = (node: Element) => Protocols | null | undefined export type ContentCallback = (node: Element) => Content | null | undefined export type ContentPropertiesCallback = ( node: Element ) => Properties | null | undefined /** * Configuration. */ export type Options = { /** * How to display referenced documents (`string?`: `_self`, `_blank`, * `_parent`, or `_top`, default: `_blank`). * The default (nothing) is to not set `target`s on links. */ target?: Target | TargetCallback | undefined /** * Link types to hint about the referenced documents. * Pass an empty array (`[]`) to not set `rel`s on links. * * **Note**: when using a `target`, add `noopener` and `noreferrer` to avoid * exploitation of the `window.opener` API. */ rel?: Rel | RelCallback | undefined /** * Protocols to check, such as `mailto` or `tel`. */ protocols?: Protocols | ProtocolsCallback | undefined /** * hast content to insert at the end of external links. * Will be inserted in a `` element. * * Useful for improving accessibility by giving users advanced warning when * opening a new window. */ content?: Content | ContentCallback | undefined /** * hast properties to add to the `span` wrapping `content`, when given. */ contentProperties?: | import('hast').Properties | ContentPropertiesCallback | undefined }