Skip to content

Commit f00dded

Browse files
New header
1 parent 66c320e commit f00dded

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ The `/markdown` endpoint retrieves a webpage's content and converts it into Mark
99

1010
## Basic usage
1111

12+
### Using a URL
13+
1214
This example fetches the Markdown representation of a webpage.
1315

1416
```bash
@@ -29,6 +31,28 @@ curl -X 'POST' 'https://api.cloudflare.com/client/v4/accounts/<accountId>/browse
2931
}
3032
```
3133

34+
### Using raw HTML
35+
36+
Instead of fetching a URL, you can provide raw HTML content directly.
37+
38+
```bash
39+
curl -X 'POST' 'https://api.cloudflare.com/client/v4/accounts/<accountId>/browser-rendering/markdown' \
40+
-H 'Content-Type: application/json' \
41+
-H 'Authorization: Bearer <apiToken>' \
42+
-d '{
43+
"html": "<div>Hello World</div>"
44+
}'
45+
```
46+
47+
### JSON response
48+
49+
```json title="json response"
50+
{
51+
"success": true,
52+
"result": "Hello World"
53+
}
54+
```
55+
3256
## Advanced usage
3357

3458
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.

0 commit comments

Comments
 (0)