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=\"https://www.youtube.com/embed/M7lc1UVf-VE\"></iframe>
" https://distro.mic.com/1.0/format?output=apple-news
… 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": "https://www.youtube.com/embed/M7lc1UVf-VE",
"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);