Skip to content

Commit 4b3c371

Browse files
authored
Update markdown-endpoint.mdx
- add subheadings - update to same style as pdf endpoint
1 parent c5a8ff2 commit 4b3c371

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

src/content/docs/browser-rendering/rest-api/markdown-endpoint.mdx

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,26 @@ import { Tabs, TabItem, Render } from "~/components";
99

1010
The `/markdown` endpoint retrieves a webpage's content and converts it into Markdown format. You can specify a URL and optional parameters to refine the extraction process.
1111

12+
## Endpoint
13+
14+
```txt
15+
https://api.cloudflare.com/client/v4/accounts/<accountId>/browser-rendering/markdown
16+
```
17+
18+
## Required fields
19+
You must provide either `url` or `html`:
20+
- `url` (string)
21+
- `html` (string)
22+
23+
## Common use cases
24+
25+
- Normalize content for downstream processing (summaries, diffs, embeddings)
26+
- Save articles or docs for editing or storage
27+
- Strip styling/scripts and keep readable content + links
28+
1229
## Basic usage
1330

14-
### Using a URL
31+
### Convert a URL to Markdown
1532

1633
<Tabs syncKey="workersExamples"> <TabItem label="curl">
1734

@@ -52,7 +69,7 @@ console.log(markdown);
5269

5370
</TabItem> </Tabs>
5471

55-
### Use raw HTML
72+
### Convert raw HTML to Markdown
5673

5774
Instead of fetching the content by specifying the URL, you can provide raw HTML content directly.
5875

@@ -74,6 +91,8 @@ curl -X 'POST' 'https://api.cloudflare.com/client/v4/accounts/<accountId>/browse
7491

7592
## Advanced usage
7693

94+
### Exclude unwanted requests (for example, CSS)
95+
7796
You can refine the Markdown extraction by using the `rejectRequestPattern` parameter. In this example, requests matching the given regex pattern (such as CSS files) are excluded.
7897

7998
```bash

0 commit comments

Comments
 (0)