# article-json-to-amp

> Render JSON formatted article in the AMP format

Latest version **3.0.2** (published 2017-04-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install article-json-to-amp
pnpm add article-json-to-amp
yarn add article-json-to-amp
bun add article-json-to-amp
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.2 |
| Published | 2017-04-04 |
| First published | 2016-01-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 13 |
| Author | mic.com |
| Maintainers | danmakenoise, ellell, iefserge, kesla, orrybaram, ryanscottaudio |

## Links

- npm: https://www.npmjs.com/package/article-json-to-amp
- Repository: https://github.com/micnews/article-json-to-amp
- Homepage: https://github.com/micnews/article-json-to-amp#readme
- Issues: https://github.com/micnews/article-json-to-amp/issues
- npm.io page: https://npm.io/package/article-json-to-amp

## Dependencies (3)

- [deku](https://npm.io/package/deku.md) ^1.0.0
- [magic-virtual-element](https://npm.io/package/magic-virtual-element.md) ^1.0.6
- [article-json-html-render](https://npm.io/package/article-json-html-render.md) ^2.0.0

## Recent versions

- 3.0.2 (latest) — 2017-04-04
- 3.0.1 — 2017-03-29
- 3.0.0 — 2017-03-29
- 1.10.7 — 2017-03-23
- 1.10.6 — 2017-01-11
- 1.10.5 — 2017-01-10
- 1.10.4 — 2017-01-06
- 1.10.3 — 2017-01-06
- 1.10.2 — 2016-12-12
- 1.10.1 — 2016-12-07
- 1.10.0 — 2016-12-07
- 1.9.0 — 2016-08-16
- 1.8.1 — 2016-08-15
- 2.0.0 — 2016-08-15
- 1.8.0 — 2016-07-29
- … 14 more at https://npm.io/package/article-json-to-amp/versions

## README

## article-json-to-amp
Render [article json](https://github.com/micnews/html-to-article-json#format) format in the [AMP](https://github.com/ampproject/amphtml) format

## Usage

```
npm install article-json-to-amp
```

```js
const convertToAmp = require('article-json-to-amp');
const article = [
  {
    type: 'paragraph',
    children: [
      {
        type: 'text',
        content: 'This is the text and '
      },
      {
        type: 'text',
        bold: true,
        content: 'some bold text '
      },
      {
        type: 'text',
        href: 'http://example.com',
        content: 'some link'
      }
    ]
  },
  {
    type: 'embed',
    embedType: 'image',
    src: 'http://example/image.jpg',
    width: 300,
    height: 150
  }
];

console.log(convertToAmp(article));
```

outputs:

```html
<article>
  <p>This is the text and <b>some bold text </b><a href="http://example.com">some link</a></p>
  <figure>
    <amp-img width="300" height="150" layout="responsive" src="http://example/image.jpg"></amp-img>
  </figure>
</article>
```

### Input format

https://github.com/micnews/html-to-article-json#format

### Rendering HTML articles

HTML article can be parsed into structured format expected by this module using [html-to-article-json](https://github.com/micnews/html-to-article-json).

## License

MIT

---
_Source: https://npm.io/package/article-json-to-amp · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
