text
Readable plain text with the markup stripped out. It resolves to a string:
const text = await microlink.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:
- selector
<string>— returns the text of the first element matching the CSS selector. - selectorAll
<string> | <string[]>— returns the text of every matching element, as an array. - type
<string>— overrides how the extracted value is normalized, per the rules grammar.
Any shared option applies too.
Examples
Skip navigation and footers by scoping to the article:
const text = await microlink.text('https://example.com/blog/post', {
selector: 'article'
})Every headline on a news front page:
const headlines = await microlink.text('https://news.ycombinator.com', {
selectorAll: '.titleline > a'
})Prefer markdown when structure matters — headings, lists, and links survive there — and
text when only the words do.See URL to Text in the content conversion guide.