Skip to content
This repository has been archived by the owner on Jul 3, 2019. It is now read-only.

Latest commit

 

History

History
53 lines (38 loc) · 1.37 KB

README.md

File metadata and controls

53 lines (38 loc) · 1.37 KB

This repo is deprecated. The parser is moved to https://github.com/enkidevs/curriculum-processors

Enki Curriculum Parser

Resources

API

const {
  types,
  getParser
} = require('@enkidevs/curriculum-parser')

const parser = getParser(types.INSIGHT)

const ast = parser.parseSync('some markdown string') // or vfile(/path/to/markdown-file)

const markdownString = parser.stringifySync(ast)  // we get back the markdown string

Usage

const {
  types, getProcessor
} = require('@enkidevs/curriculum-parser');

const remark2rehype = require('remark-rehype');
const doc = require('rehype-document');
const format = require('rehype-format');
const html = require('rehype-stringify');
var vfile = require('to-vfile');
var report = require('vfile-reporter');

getProcessor(types.INSIGHT)
  .use(remark2rehype)
  .use(doc, { title: 'Insight' })
  .use(format)
  .use(html)
  .process(vfile.readSync('insight.md'), function (err, file) {
    console.error(report(err || file));
    console.log(String(file));
  });