Skip to main content
async def extract_markdown(
    source: Page | Locator,
) -> str
Converts HTML content from a Playwright Page or Locator to semantic markdown format.

Examples

from intuned_browser import extract_markdown
async def automation(page, params, **_kwargs):
    await page.goto("https://example.com")
    header_locator = page.locator('h1')
    markdown = await extract_markdown(header_locator)
    print(markdown)  # # Page Title

Arguments

source
Page | Locator
required
The source of the HTML content. Can be a Playwright Page or a Playwright Locator. If a Playwright Page is provided, the HTML content will be extracted from the entire page. If a Playwright Locator is provided, the HTML content will be extracted from the specific element.

Returns: str

The markdown representation of the HTML content