mdast-builder
Composable functions to easily build mdast structures
Last updated 7 years ago by mike-north-bot .
BSD-2-Clause · Repository · Bugs · Original npm · Tarball · package.json
$ npm install mdast-builder 
SYNC missed versions from official npm registry.

mdast-builder

Build Status

Use composable functions to buld up a mdast structure

Use

yarn add mdast-builder
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

## Begin

these are the starting instructions

- one
- two
- three

Legal

© 2019 LinkedIn

Current Tags

  • 1.1.1                                ...           latest (7 years ago)

5 Versions

  • 1.1.1                                ...           7 years ago
  • 1.1.0                                ...           8 years ago
  • 1.0.1                                ...           8 years ago
  • 1.0.0                                ...           8 years ago
  • 0.0.0-development                                ...           8 years ago
Maintainers (1)
Downloads
Total 26
Today 1
This Week 6
This Month 26
Last Day 5
Last Week 8
Last Month 0
Dependencies (1)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE