JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 107135
  • Score
    100M100P100Q169358F
  • License MIT

retext support for remark

Package Exports

  • remark-retext

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (remark-retext) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

remark-retext Build Status Coverage Status

Bridge / mutate from remark to retext.

Installation

npm:

npm install remark-retext

Usage

var unified = require('unified');
var parse = require('remark-parse');
var lint = require('remark-lint');
var remark2retext = require('remark-retext');
var english = require('retext-english');
var equality = require('retext-equality');
var stringify = require('remark-stringify');
var report = require('vfile-reporter');

unified()
    .use(parse)
    .use(lint)
    .use(remark2retext, unified().use(english).use(equality))
    .use(stringify)
    .process('## Hello guys!', function (err, file) {
        file.filename = 'example';
        file.extension = 'md';
        process.stderr.write(report(file) + '\n');
    });

stderr(4) yields:

example.md
          1  warning  Missing newline character at end of file                             final-newline
     1-1:15  warning  First heading level should be `1`                                    first-heading-level
     1-1:15  warning  Don’t add a trailing `!` to headings                                 no-heading-punctuation
    10-1:14  warning  `guys` may be insensitive, use `people`, `persons`, `folks` instead  gals-men

⚠ 4 warnings

API

origin.use(remark2retext, destination)

Either bridge or mutate from remark (MDAST) to retext (NLCST).

destination

destination is either a parser or a processor.

If a Unified processor is given, runs the destination processor with the new NLCST tree, then, after running discards that tree and continues on running the origin processor with the original tree (bridge-mode).

If a parser (such as parse-latin, parse-english, or parse-dutch) is given, passes the tree to further plug-ins (mutate-mode).

License

MIT © Titus Wormer