Transform HTML Content to Apple News / Google AMP / Facebook Instant Articles with Distro


Automatically transform article HTML for third-party platforms such as Facebook Instant Articles, Apple News, Google AMP

“Just” make a curl request …

curl --data "
<h1>Distro.Mic example</h1>
<p>Text and media embed</p>
<iframe src=\"\"></iframe>

… and the content is “translated” to the specified format:

	"article": [{
		"text": "Distro.Mic example",
		"additions": [],
		"inlineTextStyles": [],
		"role": "heading1",
		"layout": "bodyLayout"
	}, {
		"text": "Text and media embed\n",
		"additions": [],
		"inlineTextStyles": [],
		"role": "body",
		"layout": "bodyLayout"
	}, {
		"role": "container",
		"components": [{
			"role": "embedwebvideo",
			"URL": "",
			"style": "embedMediaStyle",
			"layout": "embedMediaLayout"
		"layout": "embedLayout",
		"style": "embedStyle"
	"bundlesToUrls": {}

You can also install it as a dependency:

npm install distro-mic
import { format } from 'distro-mic';

const html = '<p>Article HTML</p>';
const output = format(html);

Distro →

Published by Bramus!

Bramus is a frontend web developer from Belgium, working as a Chrome Developer Relations Engineer at Google. From the moment he discovered view-source at the age of 14 (way back in 1997), he fell in love with the web and has been tinkering with it ever since (more …)

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.