Skip to content

Instantly share code, notes, and snippets.

Created November 2, 2017 13:29
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
retext example does not work as expected w.r.t. remark example
var unified = require('unified');
var createStream = require('unified-stream');
var parse = require('rehype-parse');
var rehype2retext = require('rehype-retext');
var rehype2remark = require('rehype-remark');
var remarkStringify = require('remark-stringify');
var retextStringify = require('retext-stringify');
var english = require('retext-english');
// Why does the following (2remark) work (output MD)
// var processor = unified()
// .use(parse)
// .use(rehype2remark)
// .use(remarkStringify);
// .. but this (2retext) does NOT work (not outputting text)
var processor = unified()
.use(rehype2retext, unified()
// `TypeError: Cannot read property 'length' of undefined at nlcstToString..`
// Ran as
// curl 2>/dev/null | node retext-stream-example.js
// Also: why is the additional `unified().use(english)` needed for retext?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment