# Autolink

> Editor42 Autolink plugin: turns a URL into a link as it is typed, when the user presses Space, Enter or a closing bracket, with patterns you can set.

Source: https://editor42.com/plugins/autolink  
Every page of editor42.com has a Markdown copy at its URL + `.md` (`index.md` after a URL that ends in `/`); all of them are in one file: https://editor42.com/llms-full.txt

Plugin alias: `autolink`

```js
editor42.init({
  plugins: 'autolink'
});
```

Automatically converts typed URLs into clickable hyperlinks as the user types. Detects URLs when the user presses Space, Enter, or a closing bracket character, then wraps the detected text in an anchor element. Supports configurable URL patterns and default link targets/protocols.

## Options

| Option | Type | Default | Description |
|---|---|---|---|
| `autolink_pattern` | `RegExp` | Standard link regex (case-insensitive) | Regular expression used to detect whether the text preceding the cursor is a valid URL. |
| `link_default_target` | `string` | — | If set, automatically applies this target attribute (e.g. `_blank`) to auto-created links. |
| `link_default_protocol` | `string` | `https` | Protocol prepended to URLs that start with `www.` |

This plugin also reads the core option `allow_unsafe_link_target` to decide whether to add `rel="noopener"` for `_blank` targets.
