---
title: Get HTML of Selected Text
description: Get the selected text from the page of the actual openend tab
---

Read the HTML behind the part of the page you have highlighted, with its links and formatting.

## What it does

Get HTML of Selected Text takes the current selection on the active tab and returns its markup, not just its words: links, bold text, list items and images inside the selection are kept as HTML. The result is stored as text in the field you name in **Output field name**.

The output holds only the new field. Turn on **Include input fields** to keep the incoming item's fields next to it.

## When to use it

* Save a highlighted passage with its links intact, for example as a note or a knowledge entry.
* Convert a selection to Markdown with the [Markdown](/nodes/builtin/datatransformation/markdown/) node before sending it somewhere.
* If you only need the words, use [Get Selected Text](/nodes/extension/getselectedtext/).

## Inputs and settings

**Output field name**: for example `selectionHtml`. Later nodes read it with `{{ $input.selectionHtml }}`.

## Outputs

One item with your field, for example `{ "selectionHtml": "Read <a href=\"https://example.com\">this guide</a>" }`.

## Dependencies and credentials

None. This node needs no connection and has no slots for other nodes.

## Example workflow

1. Add a [Context Menu](/nodes/builtin/trigger/contextmenu/) trigger.
2. Add **Get HTML of Selected Text** with **Output field name** = `selectionHtml`.
3. Add [Markdown](/nodes/builtin/datatransformation/markdown/) with **Operation** = **HTML to Markdown** and **Content** = `{{ $input.selectionHtml }}`.
4. Copy the result with [Clipboard Write](/nodes/extension/clipboardwrite/), ready to paste into your notes app.

## Common issues

* **The node fails with an error about the selection, or "No content found".** Nothing was selected on the active tab. Select the text first and keep that tab active while the workflow runs.
* **The HTML is cut in the middle of an element.** The node returns exactly the selected range. Select a little more, or read a whole element with [Get All HTML](/nodes/extension/getallhtml/) and a **DOM Selector**.
* **The node fails outside the extension.** This node runs in the browser extension; install it or run the workflow from the extension.

## Related nodes

* [Get Selected Text](/nodes/extension/getselectedtext/): the same selection as plain text.
* [Get All HTML](/nodes/extension/getallhtml/): the HTML of a whole page or element.
* [Markdown](/nodes/builtin/datatransformation/markdown/): convert between HTML and Markdown.