rehype-plaintext

1.0.0 • Public • Published

rehype-plaintext

Output plain text from rehype.

build status

Installation

This module is installed via npm:

$ npm install rehype-plaintext

Example Usage

var rehypePlaintext = require('rehype-plaintext');
 
var expect = require('expect.js'),
    unified = require('unified'),
    parseHTML = require('rehype-parse'),
    inspect = require('unist-util-inspect'),
    Readable = require('stream').Readable;
 
var s = new Readable;
s.push('<p>Hi there <em>my friend</em> I hope you are well.</p>');
s.push(null);
 
var result = '';
s.pipe(unified())
.use(parseHTML)
.use(function () {
  return function (cst) {
    console.log(inspect(cst));
  }
})
.use(rehypePlaintext)
.on('data', function(s) {
  result += s;
})
.on('end', function() {
  expect(result).to.equal('Hi there my friend I hope you are well.');
  done();
})
.on('error', done);

Acknowledgements

With thanks to https://gist.github.com/blahah/bb8ee2c7695180f425f443f88fa16b79

Readme

Keywords

Package Sidebar

Install

npm i rehype-plaintext

Weekly Downloads

40

Version

1.0.0

License

BSD-3-Clause

Last publish

Collaborators

  • noblesamurai
  • eugeneware
  • jacob-samurai
  • timlesallen