# Module /html

HTML entity escaping, attribute sanitization, and tag stripping for safe user-generated content.

```tangu
(use /html)
```

## Functions & symbols

### escape

`(escape text) -> String`

Escapes HTML special characters (`&`, `<`, `>`, `"`, `'`) for safe attribute and element rendering.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `text` | `String` | no | Plain string to HTML-escape |

```tangu
(html/escape "<b>hi</b>")
```

### escape-text

`(escape-text html) -> String`

Escapes `&`, `<`, and `>` characters in text nodes without escaping quotes.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `html` | `String` | no | String containing HTML markup |

```tangu
(html/escape-text "a < b")
```

### sanitize

`(sanitize html) -> String`

Sanitizes untrusted HTML using an allowlist-based cleaner, stripping scripts, event handlers, and unsafe URLs.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `html` | `String` | no | Untrusted HTML fragment |

```tangu
(html/sanitize user-bio-html)
```

### strip-tags

`(strip-tags html) -> String`

Strips all HTML tags and returns plain concatenated text.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `html` | `String` | no | HTML markup string |

```tangu
(html/strip-tags "<p>Hello <b>world</b></p>") ; -> "Hello world"
```
