---
title: "Helpers/html"
---
# Helpers/html

### safeOptions

**safeOptions** = `object`

Defined in: [src/core/helpers/html/safe-html.ts:14](https://github.com/xdan/jodit/blob/main/src/core/helpers/html/safe-html.ts#L14)

##### removeOnError

**removeOnError**: `boolean`

Defined in: [src/core/helpers/html/safe-html.ts:15](https://github.com/xdan/jodit/blob/main/src/core/helpers/html/safe-html.ts#L15)

##### safeJavaScriptLink

**safeJavaScriptLink**: `boolean`

Defined in: [src/core/helpers/html/safe-html.ts:16](https://github.com/xdan/jodit/blob/main/src/core/helpers/html/safe-html.ts#L16)

##### removeEventAttributes?

`optional` **removeEventAttributes?**: `boolean`

Defined in: [src/core/helpers/html/safe-html.ts:17](https://github.com/xdan/jodit/blob/main/src/core/helpers/html/safe-html.ts#L17)

##### safeLinksTarget?

`optional` **safeLinksTarget?**: `boolean`

Defined in: [src/core/helpers/html/safe-html.ts:18](https://github.com/xdan/jodit/blob/main/src/core/helpers/html/safe-html.ts#L18)

### applyStyles()

**applyStyles**(`html`): `string`

Defined in: [src/core/helpers/html/apply-styles.ts:39](https://github.com/xdan/jodit/blob/main/src/core/helpers/html/apply-styles.ts#L39)

If the HTML has CSS rules with selectors,
it applies them to the selectors in the HTML itself
and then removes the selector styles, leaving only the inline ones.

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `html` | `string` |

#### Returns

`string`

***

### cleanFromWord()

**cleanFromWord**(`html`): `string`

Defined in: [src/core/helpers/html/clean-from-word.ts:20](https://github.com/xdan/jodit/blob/main/src/core/helpers/html/clean-from-word.ts#L20)

The method automatically cleans up content from Microsoft Word and other HTML sources to ensure clean, compliant
content that matches the look and feel of the site.

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `html` | `string` |

#### Returns

`string`

***

### htmlspecialchars()

**htmlspecialchars**(`html`): `string`

Defined in: [src/core/helpers/html/htmlspecialchars.ts:16](https://github.com/xdan/jodit/blob/main/src/core/helpers/html/htmlspecialchars.ts#L16)

Convert special characters to HTML entities

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `html` | `string` |

#### Returns

`string`

***

### nl2br()

**nl2br**(`html`): `string`

Defined in: [src/core/helpers/html/nl2br.ts:14](https://github.com/xdan/jodit/blob/main/src/core/helpers/html/nl2br.ts#L14)

Inserts HTML line breaks before all newlines in a string

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `html` | `string` |

#### Returns

`string`

***

### safeHTML()

**safeHTML**(`box`, `options`): `void`

Defined in: [src/core/helpers/html/safe-html.ts:68](https://github.com/xdan/jodit/blob/main/src/core/helpers/html/safe-html.ts#L68)

Removes dangerous constructs from HTML

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `box` | [`HTMLElement`](https://developer.mozilla.org/docs/Web/API/HTMLElement) \| [`DocumentFragment`](https://developer.mozilla.org/docs/Web/API/DocumentFragment) |
| `options` | [`safeOptions`](#safeoptions) |

#### Returns

`void`

***

### sanitizeHTMLElement()

**sanitizeHTMLElement**(`elm`, `__namedParameters?`): `boolean`

Defined in: [src/core/helpers/html/safe-html.ts:193](https://github.com/xdan/jodit/blob/main/src/core/helpers/html/safe-html.ts#L193)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `elm` | [`Element`](https://developer.mozilla.org/docs/Web/API/Element) \| [`DocumentFragment`](https://developer.mozilla.org/docs/Web/API/DocumentFragment) |
| `__namedParameters` | [`safeOptions`](#safeoptions) |

#### Returns

`boolean`

***

### stripTags()

**stripTags**(`html`, `doc?`, `exclude?`, `blockBr?`): `string`

Defined in: [src/core/helpers/html/strip-tags.ts:36](https://github.com/xdan/jodit/blob/main/src/core/helpers/html/strip-tags.ts#L36)

Extract plain text from HTML text

#### Parameters

| Parameter | Type | Default value |
| ------ | ------ | ------ |
| `html` | `string` \| [`Node`](https://developer.mozilla.org/docs/Web/API/Node) | `undefined` |
| `doc` | [`Document`](https://developer.mozilla.org/docs/Web/API/Document) | `document` |
| `exclude` | [`Nullable`](./types.html#nullable)\<[`Set`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)\<[`HTMLTagNames`](./types.html#htmltagnames)\>\> | `null` |
| `blockBr` | `boolean` | `false` |

#### Returns

`string`
