← Back
Cloudflare
Cloudflare Workers AI adds customizable conversion options for Markdown processing

New Conversion Options for Markdown Conversion

Cloudflare has expanded the Markdown Conversion service in Workers AI with new customization capabilities. Developers can now pass a conversionOptions object to fine-tune how the service processes different file types.

Available Options

The new conversion options include:

  • Images: Set the language for AI-generated image descriptions (e.g., Spanish, French)
  • HTML: Use CSS selectors to extract specific content sections, or provide a hostname to resolve relative links
  • PDF: Option to exclude metadata from the output

Implementation

The feature is available through both the env.AI binding in JavaScript/TypeScript and the REST API. Using the binding, you can specify conversion options when calling toMarkdown():

await env.AI.toMarkdown(
  { name: "page.html", blob: new Blob([html]) },
  {
    conversionOptions: {
      html: { cssSelector: "article.content" },
      image: { descriptionLanguage: "es" },
    },
  },
);

The REST API also supports these options via the conversionOptions parameter, enabling conversion workflows outside of Workers edge runtime contexts.

Action Items

Developers currently using Markdown Conversion should review their use cases to determine if these new options can improve content extraction accuracy or reduce processing overhead. The feature is immediately available for new and existing deployments.