Markdown to HTML Converter - GitHub-Flavored, Safe avatar

Markdown to HTML Converter - GitHub-Flavored, Safe

Pricing

$0.50 / 1,000 converted files

Go to Apify Store
Markdown to HTML Converter - GitHub-Flavored, Safe

Markdown to HTML Converter - GitHub-Flavored, Safe

Convert Markdown to safe GitHub-flavored HTML by URL or text - anchored headings, table of contents, script/iframe stripping. Bulk. $0.0005 per conversion; failures are free.

Pricing

$0.50 / 1,000 converted files

Rating

0.0

(0)

Developer

Anthony Snider

Anthony Snider

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

3 hours ago

Last modified

Share

Markdown to HTML Converter - GitHub-Flavored, Anchored Headings, Safe Output

Turn Markdown into publish-ready HTML - GitHub-Flavored (tables, fenced code, task lists, strikethrough), with an id and a # anchor on every heading, a structured table of contents, and <script> / <iframe> / inline event handlers / javascript: URLs stripped out. From a URL or from raw text, in bulk. $0.0005 per conversion. Failures are recorded free.

This is the step between "we write docs in Markdown" and "the docs are on the site": you need the HTML, you need deep links to headings, you need a sidebar built from those headings, and you need to not paste untrusted Markdown straight into your page.

What you get

Per input, one record with these exact fields:

  • ok - true when the conversion succeeded
  • input - the URL you sent, or (inline markdown)
  • sourceUrl - the final URL after redirects, or null for inline text
  • html - the rendered, sanitized HTML
  • toc - an array of { level, text, id }, in document order, ready to render as a sidebar
  • wordCount - words in the source Markdown, with code blocks and syntax characters excluded
  • gfm - whether GitHub-Flavored mode was on
  • error - present instead of html when a fetch failed. Never charged.

Example 1: headings, anchors, TOC, and sanitization

Input:

{ "markdown": "# Release notes\n\n## Breaking changes\n\n- Dropped Node 16\n\n## Breaking changes\n\nSee [docs](https://example.com).\n\n<script>alert(1)</script>" }

Output (real run, 2026-08-15):

{
"ok": true,
"input": "(inline markdown)",
"sourceUrl": null,
"html": "<h1 id=\"release-notes\"><a class=\"anchor\" href=\"#release-notes\">#</a>Release notes</h1>\n<h2 id=\"breaking-changes\"><a class=\"anchor\" href=\"#breaking-changes\">#</a>Breaking changes</h2>\n<ul>\n<li>Dropped Node 16</li>\n</ul>\n<h2 id=\"breaking-changes-1\"><a class=\"anchor\" href=\"#breaking-changes-1\">#</a>Breaking changes</h2>\n<p>See <a href=\"https://example.com\">docs</a>.</p>\n",
"toc": [
{ "level": 1, "text": "Release notes", "id": "release-notes" },
{ "level": 2, "text": "Breaking changes", "id": "breaking-changes" },
{ "level": 2, "text": "Breaking changes", "id": "breaking-changes-1" }
],
"wordCount": 17,
"gfm": true
}

Three things worth noticing, all visible in that output: the <script> tag is gone, the duplicated heading got a unique id (breaking-changes-1) so both anchors work, and the toc mirrors the ids exactly.

Example 2: convert a README straight from its URL

Input:

{ "url": "https://raw.githubusercontent.com/apify/apify-sdk-js/master/README.md" }

The file is fetched (redirects followed, 20 second timeout) and converted. sourceUrl in the output is the final URL, so you can tell where the content actually came from.

Example 3: bulk, for a docs site build

Input:

{
"markdowns": ["# Page one\n\nBody.", "# Page two\n\nBody."],
"urls": ["https://raw.githubusercontent.com/you/repo/main/CHANGELOG.md"],
"gfm": true
}

markdowns and urls are both processed, one record and one charge each, up to 50 per run. A URL that fails to fetch becomes {"ok": false, "error": "Fetch failed: HTTP 404"} and is not charged.

Pricing

$0.0005 per conversion. No start fee. One event covers one Markdown input - a URL fetched and converted, or a text string converted - including the sanitization pass, the heading anchors and the table of contents. Failures are recorded and never charged.

Honest comparison: on 2026-08-07 there was no directly comparable paid Markdown-to-HTML actor on the Apify Store to quote a price against - the nearest paid listings convert PDFs, and a free Markdown maker exists that does not produce a TOC, anchors, or sanitized output. Rather than invent a comparator, the honest statement is: this is priced at the floor of our ladder, and if all you need is a plain render with no TOC and no sanitization, a free tool will do.

When NOT to use this

  • You need a hardened sanitizer for hostile input. The sanitization here removes scripts, iframes, inline on* handlers and javascript: URLs - the practical attacks in Markdown. It is a regex pass, not an audited HTML sanitizer with an allow-list. If you are rendering Markdown written by anonymous strangers into an authenticated page, run a real sanitizer (DOMPurify and friends) on top and set a Content-Security-Policy.
  • You need a specific Markdown dialect. This is GitHub-Flavored Markdown. MDX, Obsidian wikilinks, Pandoc citations, and footnote syntaxes outside GFM will pass through as literal text.
  • You want a styled page. You get semantic HTML, not CSS, not a full document. There is no <html> wrapper, no stylesheet, no syntax highlighting theme - that is your layer.
  • Server-side rendering inside your own app. If you already run Node, marked is free and local. This earns its price in bulk, in no-code pipelines, and as an agent tool.

Honest limits

  • Up to 50 inputs per run; 20 second fetch timeout for URLs.
  • breaks: true is on: single newlines become <br>, which matches how most people write in comment boxes but differs from strict CommonMark.
  • Syntax highlighting is not applied. Code blocks come out as <pre><code> with the language class, ready for Prism or highlight.js on your side.
  • Heading ids are slugified from the heading text; duplicates get a numeric suffix. Non-Latin headings can slugify to empty and fall back to section.

FAQ

How do I get a table of contents from my Markdown? It is built for you. The toc array gives { level, text, id } per heading in document order, and each id matches an anchor that already exists in the html, so rendering a sidebar is a map over that array.

Do headings get anchor links I can deep-link to? Yes. Every heading is emitted as <h2 id="slug"><a class="anchor" href="#slug">#</a>Title</h2>. Style .anchor however you like, or hide it and keep the id.

What happens to duplicate headings? The second one becomes slug-1, the third slug-2, and so on, so every anchor stays unique and every link resolves. You can see this in Example 1.

Is the HTML safe to embed in my page? Scripts, iframes, inline event handlers and javascript: URLs are removed. That covers the usual Markdown injection paths. For fully untrusted authors, layer your own sanitizer and a CSP - see "When NOT to use this".

Does it support tables, task lists and strikethrough? Yes, all of GitHub-Flavored Markdown, which is on by default. Set gfm: false for plain CommonMark.

Can I convert a Markdown file straight from GitHub? Yes - pass the raw file URL in url. Use the raw.githubusercontent.com form, not the HTML page URL, or you will be converting GitHub's page chrome instead of your document.

How is wordCount calculated? On the source Markdown, with fenced code blocks removed and syntax characters stripped, so it counts prose rather than punctuation and code.

Use from code or AI agents

curl -s "https://api.apify.com/v2/acts/EliAI~markdown-to-html/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
-X POST -H 'Content-Type: application/json' \
-d '{"markdown":"# Hi\n\n**bold**"}'

Agents: connect Apify MCP and call the EliAI/markdown-to-html tool.

  • Capability: render Markdown (URL or text) to GFM HTML with heading anchors, a TOC, and sanitization
  • Required input: markdown, markdowns, url, or urls
  • Returns: one record per input; html and toc are the payload
  • Bounded: 50 inputs per run; failures isolate per input
  • Side effects: none beyond fetching the URLs you named
  • HTML to Markdown (EliAI/html-to-markdown) - the inverse trip, for pulling pages into Markdown.