The `toggleMark` command toggles a specific mark on and off at the current selection.

## Parameters

`typeOrName: string | MarkType`

The type of mark that should be toggled.

`attributes?: Record<string, any>`

The attributes that should be applied to the mark. **This is optional.**

`options?: Record<string, any>`

- `extendEmptyMarkRange: boolean` \- Removes the mark even across the current selection. Defaults to `false`

## Use the toggleMark command

```javascript
// toggles a bold mark
editor.commands.toggleMark('bold')

// toggles bold mark with a color attribute
editor.commands.toggleMark('bold', { color: 'red' })

// toggles a bold mark with a color attribute and removes the mark across the current selection
editor.commands.toggleMark('bold', { color: 'red' }, { extendEmptyMarkRange: true })
```

[PreviouslysplitBlock](/content/docs/editor/api/commands/nodes-and-marks/split-block/index.html)

[Next uptoggleNode](/content/docs/editor/api/commands/nodes-and-marks/toggle-node/index.html)

On this page

[Introduction](/content/docs/editor/api/commands/nodes-and-marks/toggle-mark#page-title/index.html) [Parameters](/content/docs/editor/api/commands/nodes-and-marks/toggle-mark#parameters/index.html) [Use the toggleMark command](/content/docs/editor/api/commands/nodes-and-marks/toggle-mark#use-the-togglemark-command/index.html)
