> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superdoc.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Highlight extension

Apply background colors to emphasize important text.

Color-coded highlighting for review, categorization, and emphasis.

## OOXML Structure

```xml theme={null}
<w:r>
  <w:rPr>
    <w:highlight w:val="yellow"/>
  </w:rPr>
  <w:t>Highlighted text</w:t>
</w:r>
```

## Use case

* **Document review** - Color-code feedback
* **Study notes** - Highlight key concepts
* **Status tracking** - Visual progress indicators
* **Multi-reviewer** - Each person uses different color
* **Categorization** - Group related content by color

## Options

Configure the extension behavior:

**htmlAttributes** `Object` (default: \{})

HTML attributes for highlight elements

## Attributes

Node attributes that can be set and retrieved:

**color** `string`

Background color (CSS color value)

## Commands

### `setHighlight`

Apply highlight with specified color

**Example:**

```javascript Usage theme={null}
editor.commands.setHighlight('#FFEB3B')
editor.commands.setHighlight('rgba(255, 235, 59, 0.5)')
```

```javascript Full Example theme={null}
import { SuperDoc } from 'superdoc';
import 'superdoc/style.css';

const superdoc = new SuperDoc({
  selector: '#editor',
  document: yourFile,
  onReady: (superdoc) => {
    const editor = superdoc.activeEditor;
    editor.commands.setHighlight('#FFEB3B');
    editor.commands.setHighlight('rgba(255, 235, 59, 0.5)');
  },
});
```

**Parameters:**

**color** `string` *required*

CSS color value

### `unsetHighlight`

Remove highlight formatting

**Example:**

```javascript Usage theme={null}
editor.commands.unsetHighlight()
```

```javascript Full Example theme={null}
import { SuperDoc } from 'superdoc';
import 'superdoc/style.css';

const superdoc = new SuperDoc({
  selector: '#editor',
  document: yourFile,
  onReady: (superdoc) => {
    const editor = superdoc.activeEditor;
    editor.commands.unsetHighlight();
  },
});
```

### `toggleHighlight`

Toggle highlight formatting

**Example:**

```javascript Usage theme={null}
editor.commands.toggleHighlight()
```

```javascript Full Example theme={null}
import { SuperDoc } from 'superdoc';
import 'superdoc/style.css';

const superdoc = new SuperDoc({
  selector: '#editor',
  document: yourFile,
  onReady: (superdoc) => {
    const editor = superdoc.activeEditor;
    editor.commands.toggleHighlight();
  },
});
```

## Keyboard shortcuts

| Command | Shortcut | Description |
| - | - | - |
| toggleHighlight() | `⌘/Ctrl-Shift-h` | Toggle highlighted formatting |

## Source code

[View on GitHub →](https://github.com/superdoc/docx-editor/tree/main/packages/super-editor/src/editors/v1/extensions/highlight/highlight.js)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.