Inline HTML and Markdown to Clean Markdown
Pricing
from $0.67 / 1,000 markdown document converteds
Inline HTML and Markdown to Clean Markdown
Turn HTML snippets or Markdown text you supply into clean, normalized Markdown for LLM prompts and content pipelines. Keeps headings, paragraphs, quotes, code blocks, safe links and flat lists, drops scripts and styles, and adds SHA-256 hashes of source and output. Does not fetch web pages.
Pricing
from $0.67 / 1,000 markdown document converteds
Rating
0.0
(0)
Developer
PlainKit bin
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
5 days ago
Last modified
Categories
Features
Share
Introduction
Inline HTML and Markdown to Clean Markdown converts inline HTML snippets or raw Markdown documents into normalized, clean Markdown with SHA-256 integrity hashes for both source and output. Designed for prompt preparation and content pipelines, this Actor operates purely on submitted text payloads without making external network calls or opening disk files. For format=html only, it cleans script, style, and noscript elements, standardizes line endings to LF, and formats headings and paragraphs cleanly; "clean" promises no transformations beyond the exact rules detailed in the "What is converted" section below. E-mail addresses and phone numbers in the content and names are automatically replaced with placeholders in markdown and document_name. The sha256.source digest covers the original raw input document content, while sha256.markdown covers the scrubbed output Markdown text.
What is converted
Conversion behavior depends strictly on the input format declaration:
For format=html
- Kept elements:
- Headings:
<h1>through<h6>tags become standard#through######Markdown headers. - Paragraphs:
<p>blocks are preserved and separated by clean blank lines. - Blockquotes:
<blockquote>tags become>prefixed Markdown quotes. - Code blocks:
<pre>elements are converted to fenced code blocks (```). - Safe links:
<a>tags withhreftargets usinghttp,https, ormailtoschemes, or having no scheme (relative paths), are kept as standard[link text](url)links. - Flat bullet items:
<li>items within<ul>or<ol>are converted to flat-bullet items.
- Headings:
- Dropped elements and limitations:
- Script, style, and noscript: Elements inside
<script>,<style>, and<noscript>tags are removed completely. - Bold, italic, and inline code markup: Formatting tags (
<b>,<strong>,<i>,<em>,<code>) are dropped; only the inner plain text is retained. - Images and alt text:
<img>tags and theiraltattributes are completely dropped and produce no output text. - List nesting: Nested lists are flattened into top-level bullet points; nesting indentations and hierarchy are dropped.
- Table structure: Table rows (
<tr>) with cells (<td>,<th>) are emitted as pipe-separated text (cell1 | cell2) without Markdown header separator rows, so rows are not a Markdown table. - Unsafe link targets: Any
hrefscheme other thanhttp,https, ormailto(such asjavascript:,data:, or disguised schemes with whitespace or control characters) is dropped, keeping only the link text.
- Script, style, and noscript: Elements inside
For format=markdown
- Preserved content:
- Headings, paragraphs, fenced code blocks, and blockquotes are preserved.
- Indented code blocks: Leading 4-space indentation is preserved.
- Raw HTML and links: Raw HTML markup (including
<script>,<style>, and raw<a href="...">links) inside Markdown text is passed through verbatim and not cleaned or stripped.
Use cases
- LLM prompt preparation: Clean and normalize messy HTML snippets or unstructured Markdown notes before feeding them to AI models.
- Content pipeline normalization: Enforce consistent blank-line spacing and clean block prefixes across diverse multi-source text inputs.
- Deduplication indexing: Use the deterministic SHA-256 hashes of input source and converted clean Markdown to index and deduplicate text items downstream.
Tutorial
Step-by-step guide
- Prepare a JSON payload with a
documentsarray containing up to 1,000 document objects withname,format(htmlormarkdown), andcontent. - Execute the Actor on Apify platform via web UI or API call.
- The Actor processes each document in memory, converting markup tags into canonical Markdown and computing content hashes.
- Retrieve the transformed dataset containing clean Markdown, block counts, and source/markdown SHA-256 hashes.
Pricing
The Actor is priced per converted document using Pay-Per-Event under the markdown_conversion_document event. With the container document limit capped at 1,000 documents per execution, the largest bill per run is $1.00 for FREE tier, $0.90 for BRONZE tier, $0.80 for SILVER tier, $0.667 for GOLD tier, $0.667 for PLATINUM tier, and $0.667 for DIAMOND tier.
| Pricing tier | Price per event | Largest bill per run (1,000 docs) |
|---|---|---|
| FREE | $0.001 | $1.00 |
| BRONZE | $0.0009 | $0.90 |
| SILVER | $0.0008 | $0.80 |
| GOLD | $0.000667 | $0.667 |
| PLATINUM | $0.000667 | $0.667 |
| DIAMOND | $0.000667 | $0.667 |
Charge contract
Each row is pushed first and charged right after a successful push; a refused charge stops work and that row stays delivered and uncharged; a reached limit stops work after that row was charged; failed items are neither pushed nor charged. A document that cannot be converted is skipped with a reason code, logged by its index and counted in the status message; it is neither pushed nor charged, and the run still succeeds. Only an input structure or size violation fails the whole run. Rows already in the dataset of a restarted run (matched by the pair of input_index and source sha256) are skipped and not charged again; if the dataset of a restarted run cannot be read, the run fails with DATASET_READ_FAILED before any new row or charge.
Operational limits
- Accepts 1 to 1,000 documents per execution.
- Document names must be 1 to 128 characters and contain no path separators (
/or\). - Each individual content string is limited to 1,000,000 UTF-8 bytes; total combined content must not exceed 5,000,000 bytes.
- Maximum 10,000 converted blocks and 2,000,000 output characters per document.
- Runs are bounded by a 3,600-second container timeout with a 30-second safety margin (RUN_TIME_BUDGET_REACHED).
Input and output examples
Input example
{"documents": [{"name": "welcome.html","format": "html","content": "<h1>Hello</h1><p>Welcome to Markdown.</p>"}]}
Output example
{"input_index": 0,"markdown": "# Hello\n\nWelcome to Markdown.\n","document_name": "welcome.html","source_format": "html","block_count": 2,"sha256": {"source": "075eddbe4d0c02440b8bebd0382e96c9490206d681815ddf8dad31433d0320bb","markdown": "5e25c21b8a06ce280b85852de945ace459afb41385c20a77462aa3401f72d892"}}
Output fields
| Field | Type | Description |
|---|---|---|
input_index | Integer | 0-based position of the document in the input list |
markdown | String | Clean, normalized Markdown text representation |
document_name | String | Identifier name provided in the input document object |
source_format | String | Format declaration (html or markdown) |
block_count | Integer | Total count of converted structural blocks |
sha256.source | String | SHA-256 hash of the input document content |
sha256.markdown | String | SHA-256 hash of the generated clean Markdown |
Content scrubbing and digest coverage
E-mail addresses and phone numbers detected in document content or names are replaced with [email removed] and [phone removed] placeholders in both markdown and document_name fields. The sha256.source digest represents the SHA-256 hash of the verbatim input document content prior to transformation, whereas sha256.markdown represents the SHA-256 hash of the delivered clean Markdown after contact scrubbing.
Actor recommendations
Pair this Actor with:
- Readable Article Extractor: Refine raw article text into standardized Markdown blocks.
- Web Page to Markdown Converter: Convert full live web pages to Markdown before running lightweight inline cleanup.
- CSV and JSON Integrity Parser: Validate tabular data accompanying your textual documentation datasets.
FAQ and support
Can I pass web URLs or local file paths?
No. Provide raw string content directly inside the content field.
Does it strip scripts and stylesheets from HTML?
Yes, for format=html only. Elements within <script>, <style>, and <noscript> tags in HTML input are removed before parsing text. In format=markdown, raw HTML elements are passed through untouched.
Does it deduplicate items automatically?
No. The Actor produces SHA-256 digests for each document, allowing you to filter duplicates downstream in your own pipeline.
Support and inquiries
For questions, feedback, or issues, submit a ticket in the Apify Console.