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

Dependencies (0)

    Dev Dependencies (16)

    Package Sidebar

    Install

    npm i remark-redact

    Weekly Downloads

    0

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    22.7 kB

    Total Files

    9

    Last publish

    Collaborators

    • seafoam6