# Anchor

> Editor42 Anchor plugin: insert and edit named anchors, the bookmarks a link can jump to, through a dialog that checks the anchor ID is a valid one.

Source: https://editor42.com/plugins/anchor  
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: `anchor`

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

Allows inserting and editing named anchor elements (bookmark links) in the editor content. Opens a dialog to set an anchor ID, validates it against HTML4 ID rules, and supports both empty anchors displayed as inline markers and anchors wrapping selected content.

## Options

| Option | Type | Default | Description |
|---|---|---|---|
| `allow_html_in_named_anchor` | `boolean` | `false` | When true, allows the anchor to wrap selected HTML content instead of inserting an empty anchor element. |

## Commands

| Command | Description |
|---|---|
| `editor42Anchor` | Opens the anchor dialog to insert or edit a named anchor at the current selection. |

## Toolbar buttons

| Name | Type | Description |
|---|---|---|
| `anchor` | Toggle button | Active when the cursor is inside a named anchor. |

## Menu items

| Name | Description |
|---|---|
| `anchor` | Opens the anchor dialog. |
