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

### safeOptions

**safeOptions** = `object`

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)

##### removeOnError

**removeOnError**: `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)

##### safeJavaScriptLink

**safeJavaScriptLink**: `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)

##### removeEventAttributes?

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

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

##### safeLinksTarget?

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

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

### applyStyles()

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

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

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:21](https://github.com/xdan/jodit/blob/main/src/core/helpers/html/clean-from-word.ts#L21)

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:73](https://github.com/xdan/jodit/blob/main/src/core/helpers/html/safe-html.ts#L73)

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:207](https://github.com/xdan/jodit/blob/main/src/core/helpers/html/safe-html.ts#L207)

#### 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:35](https://github.com/xdan/jodit/blob/main/src/core/helpers/html/strip-tags.ts#L35)

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`
