# mdast-builder

> Composable functions to easily build mdast structures

Latest version **1.1.1** (published 2019-07-28) · BSD-2-Clause license · 0 weekly downloads

## Install

```sh
npm install mdast-builder
pnpm add mdast-builder
yarn add mdast-builder
bun add mdast-builder
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2019-07-28 |
| First published | 2019-02-16 |
| Weekly downloads | 0 |
| License | BSD-2-Clause |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 32.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 20 |
| Maintainers | mike-north-bot |
| Keywords | mdast |

## Links

- npm: https://www.npmjs.com/package/mdast-builder
- Repository: https://github.com/mike-north/mdast-builder
- Homepage: https://github.com/mike-north/mdast-builder#readme
- Issues: https://github.com/mike-north/mdast-builder/issues
- npm.io page: https://npm.io/package/mdast-builder

## Dependencies (1)

- [@types/unist](https://npm.io/package/@types/unist.md) ^2.0.3

## Alternatives

- [@mdxeditor/editor](https://npm.io/package/@mdxeditor/editor.md) — 962.4K weekly downloads
- [mmdb-lib](https://npm.io/package/mmdb-lib.md) — 680.9K weekly downloads
- [playcanvas](https://npm.io/package/playcanvas.md) — 36.2K weekly downloads
- [@glw907/cairn-cms](https://npm.io/package/@glw907/cairn-cms.md) — 967 weekly downloads
- [markdown-to-confluence](https://npm.io/package/markdown-to-confluence.md) — 103 weekly downloads

## Recent versions

- 1.1.1 (latest) — 2019-07-28
- 1.1.0 — 2019-02-22
- 1.0.1 — 2019-02-16
- 1.0.0 — 2019-02-16
- 0.0.0-development — 2019-02-16

## README

# mdast-builder

[![Build Status](https://travis-ci.com/mike-north/mdast-builder.svg?branch=master)](https://travis-ci.com/mike-north/mdast-builder)

Use composable functions to buld up a [`mdast`](https://github.com/syntax-tree/mdast) structure

## Use

```sh
yarn add mdast-builder
```

```ts
import {
  root,
  paragraph,
  text,
  heading,
  list,
  listItem,
  brk
} from 'mdast-builder';
import * as stringify from 'remark-stringify';
import * as unified from 'unified';

const processor = unified().use(stringify, {
  bullet: '-',
  fence: '`',
  fences: true,
  incrementListMarker: false
});

const output = processor.stringify(
  root([
    heading(2, text('Begin')),
    paragraph([
      paragraph(text('these are the starting instructions')),
      brk,
      brk,
      list('unordered', [
        listItem(text('one')),
        listItem(text('two')),
        listItem(text('three'))
      ])
    ])
  ])
);
```

`output` will equal

```md
## Begin

these are the starting instructions

- one
- two
- three
```

## Legal

&copy; 2019 LinkedIn

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