Clean Web HTML to LLM-Ready Markdown Converter avatar

Clean Web HTML to LLM-Ready Markdown Converter

Pricing

from $1.00 / 1,000 processed items

Go to Apify Store
Clean Web HTML to LLM-Ready Markdown Converter

Clean Web HTML to LLM-Ready Markdown Converter

Deterministic, zero-latency converter that strips boilerplate, ads, and scripts from HTML into clean, token-efficient Markdown for LLM & RAG pipelines.

Pricing

from $1.00 / 1,000 processed items

Rating

0.0

(0)

Developer

Nadim Hider

Nadim Hider

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

13 days ago

Last modified

Categories

Security

Limited permissions

Share

An ultra-fast, deterministic Apify Actor that strips away boilerplate, navigational noise, tracking scripts, and styling from messy HTML documents, outputting clean, token-efficient GitHub-flavored Markdown specifically formatted for Large Language Models (LLMs), RAG pipelines, and AI agent workflows.


🚀 Why Use This Actor?

Feeding raw web pages or messy HTML directly into LLMs wastes up to 70% of your prompt tokens on boilerplate headers, footers, stylesheets, SVG icons, and ads. This Actor provides a zero-latency, deterministic transformation pipeline that:

  • Reduces LLM Token Usage: Cuts token counts drastically, saving significant API costs on OpenAI, Anthropic, Gemini, and local LLMs.
  • Zero Hallucination / 100% Deterministic: Uses strict structural DOM parsing (BeautifulSoup4 + markdownify) rather than probabilistic AI models.
  • Preserves Critical Content: Retains semantic headings, lists, inline formatting, code snippets, and Markdown tables.
  • Extracts Key Meta Fields: Pulls document titles, SEO meta descriptions, and heading hierarchies into structured JSON attributes alongside the markdown body.
  • Ideal for AI Automations: Seamlessly plugs into n8n, Make.com, LangChain, LlamaIndex, and Apify MCP servers.

📥 Input Schema

FieldTypeDefaultDescription
documentsArray of ObjectsSample Demo DocumentArray of objects with source_id and raw html strings.
strip_linksBooleanfalseWhen true, strips hyperlinks while preserving anchor text to minimize token overhead.
heading_styleString"ATX""ATX" uses # Heading, while "UNDERLINE" uses === and ---.
extract_tablesBooleantrueFormats HTML tables into standard Markdown grid tables.

Sample Input JSON

{
"documents": [
{
"source_id": "article-101",
"html": "<html><head><title>AI Trends</title></head><body><header>Nav</header><main><h1>Top Trends</h1><p>Autonomous agents are scaling rapidly.</p></main><footer>Footer</footer></body></html>"
}
],
"strip_links": false,
"heading_style": "ATX",
"extract_tables": true
}

📤 Output Dataset Format

Each processed document yields a structured record in the default dataset:

{
"source_id": "article-101",
"title": "AI Trends",
"meta_description": "",
"markdown": "# Top Trends\n\nAutonomous agents are scaling rapidly.",
"character_count": 52,
"estimated_tokens": 13,
"headings": [
"H1: Top Trends"
],
"status": "success"
}

💰 Pay-Per-Event (PPE) Pricing

This Actor utilizes Apify's modern Pay-Per-Event billing model:

  • Event Name: item-processed
  • Cost: Only $0.001 per document ($1.00 per 1,000 documents).
  • No Monthly Minimums: Pay only for the documents you actually convert. Compute overhead is practically zero, providing the highest ROI for production ingestion pipelines.

🔌 API & Python Client Example

from apify_client import ApifyClient
client = ApifyClient("YOUR_APIFY_TOKEN")
run_input = {
"documents": [
{"source_id": "doc1", "html": "<h1>Hello World</h1><p>Content to clean.</p>"}
]
}
run = client.actor("YOUR_USERNAME/html-to-llm-markdown").call(run_input=run_input)
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
print(item["markdown"])