Skip to main content
export declare function extractMarkdown(input: {
  source: Page | Locator;
}): Promise<string>;
Converts HTML content from a Playwright Page or Locator to semantic markdown format.

Examples

import { extractMarkdown } from "@intuned/browser";
export default async function handler(params, page, context){
await page.goto("https://example.com");
const headerLocator = page.locator('h1')
const markdown = await extractMarkdown({ source: headerLocator })
console.log(markdown); // Outputs the markdown representation of the header
}

Arguments

input
Object
required
The input object containing the source of the HTML content

Returns: Promise<string>

Promise that resolves to the markdown representation of the HTML content