chin-plugin-unified

0.0.4 • Public • Published

chin-plugin-unified

npm npm Build Status Coverage Status

chin plugin using unified.

Installation

yarn add -D chin chin-plugin-unified

Usage

unified(extension, list|preset)

Just using processor.use().

import unified from 'chin-plugin-unified'
import md2mdast from 'remark-parse'
import mdast2hast from 'remark-rehype'
import hastformat from 'rehype-format'
import hast2html from 'rehype-stringify'
 
// as list
const md = unified('.html', [
  [md2mdast, {}],
  [mdast2hast, {}],
  [hastformat, {}],
  [hast2html, {}]
])
 
// as preset
const md = unified('.html', {
  settings: {},
  plugins: [
    [md2mdast, {}],
    [mdast2hast, {}],
    [hastformat, {}],
    [hast2html, {}]
  ]
})

unified(type, list|options)

Determines parser/compiler(/extension) by type.

import unified from 'chin-plugin-unified'
import mdast2hast from 'remark-rehype'
import hastformat from 'rehype-format'
 
// as list
const md = unified('m2h', [
  [mdast2hast, {}],
  [hastformat, {}]
])
 
// as options
const md = unified('m2h', {
  parse: {},
  compile: {},
  settings: {},
  plugins: [
    [mdast2hast, {}],
    [hastformat, {}]
  ]
})

type

value parser compiler required in list
"h2h" rehype-parser rehype-stringify
"h2m" rehype-parser remark-stringify rehype-remark
"m2m" remark-parser remark-stringify
"m2h" remark-parser rehype-stringify remark-rehype

options ( extends preset )

  • setting
  • plugins set to list
  • parse options passed to parser.
  • compile options passed to compiler.

reference

License

MIT (http://opensource.org/licenses/MIT)

Package Sidebar

Install

npm i chin-plugin-unified

Weekly Downloads

0

Version

0.0.4

License

MIT

Unpacked Size

7.26 kB

Total Files

4

Last publish

Collaborators

  • kthjm