npm

Does your artifact manager get in the way? Join us on Oct. 8 at 10am PT, to discuss how npm can help.Sign up »

remark-redact

1.0.3 • Public • Published

remark-redact

This plugin parses markdown to obscure passages between two tokens.

Syntax

You can redact passages of your text like this:

  Please don't show my /~ Secret Stuff ~/

Any alphanumeric characters between the /~ and ~/ will will be replaced with a . Like so:

  Please don't show my  ██████ █████

WARNING

This plugin obscures text from being read after it is processed. If your source markdown files reside on a public repo, they will, obviously, not be protected by this plugin.

Configuration

There are currently three options available, which are passed in via a single configuration object.

{beginMarker = '/~', endMarker = '~/', replacer: '█'}

Therefore, invoking this plugin this way:

  .use(redact, {
    beginMarker: '<',
    endMarker: '>',
    replacer: 'X'
  })

will make this plugin remove what's put between < and > and replace those characters with X.

Usage

Dependencies:

const unified = require("unified");
const remarkParse = require("remark-parse");
const stringify = require("rehype-stringify");
const remark2rehype = require("remark-rehype");
 
const remarkRedact = require("remark-redact");

Usage:

unified()
  .use(remarkParse)
  .use(remarkRedact)
  .use(remark2rehype)
  .use(stringify);

License

MIT © Steve Barman

Redact is very very heavily indebted to remark-comments

install

npm i remark-redact

Downloadsweekly downloads

5

version

1.0.3

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability