Skip to content
A plugin to redact parts of your markdown file.
JavaScript
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
__tests__
lib
src
.babelrc
.eslintrc.json
.gitignore
LICENSE
package-lock.json
package.json
readme.md

readme.md

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

You can’t perform that action at this time.