/remark-plain-text

remark plugin to compile Markdown to plain text.

Primary LanguageMakefileMIT LicenseMIT

remark-plain-text

NPM version Build Status Coverage Status Dependencies

remark plugin to compile Markdown to plain text.

Installation

$ npm install remark-plain-text

Usage

var toPlainText = require( 'remark-plain-text' );

toPlainText()

Compiles Markdown to plain text.

var remark = require( 'remark' );

remark.use( toPlainText );

Examples

var fs = require( 'fs' );
var path = require( 'path' );
var remark = require( 'remark' );
var toPlainText = require( 'remark-plain-text' );

var fpath;
var opts;
var file;
var doc;

// Load a Markdown file...
fpath = path.join( __dirname, 'fixtures/input.md' );
opts = {
    'encoding': 'utf8'
};
file = fs.readFileSync( fpath, opts );

// Compile the Markdown file to plain text:
doc = remark.use( toPlainText ).process( file );

// Write the file to disk...
fpath = path.join( __dirname, 'fixtures/output.md' );
fs.writeFileSync( fpath, doc, opts );

To run the example code from the top-level application directory,

$ node ./examples/index.js

Tests

Unit

This repository uses tape for unit tests. To run the tests, execute the following command in the top-level application directory:

$ make test

All new feature development should have corresponding unit tests to validate correct functionality.

Test Coverage

This repository uses Istanbul as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:

$ make test-cov

Istanbul creates a ./reports/coverage directory. To access an HTML version of the report,

$ make view-cov

License

MIT license.

Copyright

Copyright © 2016. Athan Reines.