Skip to main content

Redact portions of content if a condition is met

Project description

Markdown Redact

An extremely simple markdown extension that will optionally redact content from a document.

Installation

This extension is designed for python-markdown.

pip install markdown md-redact

Usage

In your environment:

export MD_REDACT_CONTENT=1

In your markdown document:

This is $some sensitive content$ in a markdown document.

In your Python code:

import markdown


with open("filename.md", "r") as input_file:
    text = input_file.read()

html = markdown.markdown(, extensions=["md_redact"])

# html == '<p>This is <span class="redacted">(redacted)</span> in a markdown document.</p>'

Or from the command line:

MD_REDACT_CONTENT=1 python -m markdown -x md_redact filename.md

Why?

Processing markdown for a project where some users were allowed to see specific content while others were not. Figured an inline processor might be easier than locking the users lacking permissions out of the page entirely.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

md-redact-0.2.0.tar.gz (2.8 kB view hashes)

Uploaded Source

Built Distribution

md_redact-0.2.0-py3-none-any.whl (2.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page