You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

mdast-builder

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mdast-builder

Composable functions to easily build mdast structures

1.1.1
latest
Source
npmnpm
Version published
Weekly downloads
27K
15.73%
Maintainers
1
Weekly downloads
 
Created
Source

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

© 2019 LinkedIn

Keywords

mdast

FAQs

Package last updated on 28 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts