# text

## Table of Contents

- [Options](#options)
- [Examples](#examples)

---

Readable plain text with the markup stripped out. It resolves to a string:

```js
consttext=awaitmicrolink.text('https://example.com')
```

Leading, trailing, and repeated whitespace is collapsed, which keeps the output compact for indexing, search, or token-budgeted prompts. PDFs with a text layer and office documents are converted too.

## Options

It takes the same scoping options as [markdown](https://microlink.io/docs/sdk/methods/markdown):

- [selector](https://microlink.io/docs/sdk/methods/extract/selector) `<string>` — returns the text of the first element matching the CSS selector.
- [selectorAll](https://microlink.io/docs/sdk/methods/extract/selectorAll) `<string> | <string[]>` — returns the text of every matching element, as an array.
- [type](https://microlink.io/docs/sdk/methods/extract/type) `<string>` — overrides how the extracted value is normalized, per the [rules grammar](https://microlink.io/docs/sdk/methods/extract).

Any [shared option](https://microlink.io/docs/sdk/getting-started/options) applies too.

## Examples

Skip navigation and footers by scoping to the article:

```js
consttext=awaitmicrolink.text('https://example.com/blog/post',{

selector:'article'

})
```

Every headline on a news front page:

```js
constheadlines=awaitmicrolink.text('https://news.ycombinator.com',{

selectorAll:'.titleline > a'

})
```

Prefer [markdown](https://microlink.io/docs/sdk/methods/markdown) when structure matters — headings, lists, and links survive there — and `text` when only the words do.

See [URL to Text](https://microlink.io/docs/guides/content-conversion/url-to-text) in the content conversion guide.