# text

URL: /patitas/api/utils/text/
Section: utils
Description: Text processing utilities for Patitas.

Provides canonical implementations for common text operations like slugification.

Example:
    >>> from patitas.utils.text import slugify
    >>> slugify("Hello World!")
    'hello-world'

---

> For a complete page index, fetch /patitas/llms.txt.

Open LLM text
(/patitas/api/utils/text/index.txt)

Share with AI

Ask Claude
(https://claude.ai/new?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fpatitas%2Fapi%2Futils%2Ftext%2Findex.txt)

Ask ChatGPT
(https://chatgpt.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fpatitas%2Fapi%2Futils%2Ftext%2Findex.txt)

Ask Gemini
(https://gemini.google.com/app?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fpatitas%2Fapi%2Futils%2Ftext%2Findex.txt)

Ask Copilot
(https://copilot.microsoft.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fpatitas%2Fapi%2Futils%2Ftext%2Findex.txt)

Module

#
`utils.text`

Text processing utilities for Patitas.

Provides canonical implementations for common text operations like slugification.

Example:

```
>>> from patitas.utils.text import slugify
>>> slugify("Hello World!")
'hello-world'
```

2Functions

## Functions

`slugify`

4

`str`

▼

Convert text to URL-safe slug with Unicode support.

Preserves Unicode word cha…

`def slugify(text: str, unescape_html: bool = True, max_length: int | None = None, separator: str = '-') -> str`

Convert text to URL-safe slug with Unicode support.

Preserves Unicode word characters (letters, digits, underscore) to support
international content. Modern web browsers and servers handle Unicode URLs.

##### Parameters

Name
Type
Description

`text`
`str`

Text to slugify

`unescape_html`
`bool`

Whether to decode HTML entities first (e.g., & -> &)

Default:`True`

`max_length`
`int | None`

Maximum slug length (None = unlimited)

Default:`None`

`separator`
`str`

Character to use between words (default: '-')

Default:`'-'`

##### Returns

`str`

`escape_html`

1

`str`

▼

Escape HTML special characters for safe use in attributes.

**Converts special …

`def escape_html(text: str) -> str`

Escape HTML special characters for safe use in attributes.

Converts special characters to HTML entities:

- & becomes &

- < becomes <

-

becomes >

- " becomes "

- ' becomes '

##### Parameters

Name
Type
Description

`text`
`str`

Text to escape

##### Returns

`str`
