1.0.0 • Published 5 years ago

unified-noop-parser v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

unified-noop-parser

Parser for unified that returns the input unmodified.

This one-liner is useful in cases where you want to run a transform-and-compile pipeline that shares the same unified instance, e.g. to have access to the same data prop in the transforming and compilation phases.

Example

const unified = require('unified');
const noop = require('unified-noop-parser');
const frontmatter = require('remark-frontmatter');
const extract = require('remark-extract-frontmatter');
const yaml = require('yaml').parse;
const stringify = require('remark-stringify');

const tree = {
  /* MDAST from previous steps */
};

unified()
  .use(noop)
  .use(frontmatter)
  .use(extract, { yaml })
  .use(stringify)
  .process(tree)
  .then(({ data, contents }) =>
    console.log('Frontmatter:', data, '\nAST', contents)
  );
1.0.0

5 years ago