Skip to content

Instantly share code, notes, and snippets.

@rubys
Created June 24, 2018 19:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rubys/a061064e0744a5792b3e8331b0dae37d to your computer and use it in GitHub Desktop.
Save rubys/a061064e0744a5792b3e8331b0dae37d to your computer and use it in GitHub Desktop.
Processing all runs out of heapspace using remark
'use strict';
const fs = require('fs');
const processIncludes = require('./preprocess');
const unified = require('unified');
const markdown = require('remark-parse');
const remark2rehype = require('remark-rehype');
const html = require('rehype-stringify');
const inputFile = '../../doc/api/all.md';
let input = fs.readFileSync(inputFile, 'utf8');
console.log(input);
processIncludes(inputFile, input, (err, fulltext) => {
unified()
.use(markdown)
.use(remark2rehype)
.use(html)
.process(fulltext, (err, text) => {console.log(err || text)});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment