ENF News Bot
Automated News Bot
- Joined
- Apr 15, 2022
- Messages
- 2,591
You can now customize how the Markdown Conversion service processes different file types by passing a
Available options:
Use the
Or call the REST API:
For more details, refer to Conversion Options.
Continue reading...
conversionOptions object.Available options:
- Images: Set the language for AI-generated image descriptions
- HTML: Use CSS selectors to extract specific content, or provide a hostname to resolve relative links
- PDF: Exclude metadata from the output
Use the
env.AI binding:
Code:
await env.AI.toMarkdown(
{ name: "page.html", blob: new Blob([html]) },
{
conversionOptions: {
html: { cssSelector: "article.content" },
image: { descriptionLanguage: "es" },
},
},
);
Code:
await env.AI.toMarkdown(
{ name: "page.html", blob: new Blob([html]) },
{
conversionOptions: {
html: { cssSelector: "article.content" },
image: { descriptionLanguage: "es" },
},
},
);
Or call the REST API:
Code:
curl https://api.cloudflare.com/client/v4/accounts/{ACCOUNT_ID}/ai/tomarkdown \
-H 'Authorization: Bearer {API_TOKEN}' \
-F 'files=@index.html' \
-F 'conversionOptions={"html": {"cssSelector": "article.content"}}'
For more details, refer to Conversion Options.
Continue reading...