> ## Documentation Index
> Fetch the complete documentation index at: https://intunedhq.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# extract_markdown

Converts HTML content from a Playwright Page or Locator to semantic markdown format.

```python theme={null}
async def extract_markdown(
    source: Page | Locator,
) -> str
```

## Examples

```python Extract Markdown from Locator theme={null}
from typing import TypedDict
from playwright.async_api import Page
from intuned_browser import extract_markdown
class Params(TypedDict):
    pass
async def automation(page: Page, params: Params, **_kwargs):
    await page.goto("https://books.toscrape.com/")
    header_locator = page.locator('h1').first  # First title on the page
    markdown = await extract_markdown(header_locator)  # Extract markdown from the first title
    print(markdown)
    return markdown
```

```python Extract Markdown from Page theme={null}
from typing import TypedDict
from playwright.async_api import Page
from intuned_browser import extract_markdown
class Params(TypedDict):
    pass
async def automation(page: Page, params: Params, **_kwargs):
    await page.goto("https://sandbox.intuned.dev/pdfs")
    markdown = await extract_markdown(page)
    print(markdown)
    return markdown
```

## Arguments

**source** `Page | Locator` *required*

The source of the HTML content. When a Page is provided, extracts from the entire page. When a Locator is provided, extracts from that specific element.

## Returns: `str`

The markdown representation of the HTML content


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.