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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file md-redact-0.2.0.tar.gz.

File metadata

  • Download URL: md-redact-0.2.0.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.9.7 Darwin/21.2.0

File hashes

Hashes for md-redact-0.2.0.tar.gz
Algorithm Hash digest
SHA256 91867e14a5afda040a9f0be4b588f9c43fd95d39207ea8f68ffc1cf9da542b49
MD5 820f8bb16d7624d0322882767bad7b3c
BLAKE2b-256 7a4959f717e7d51e5c0ca544d339eef4909cfb1c777464456117ec4625d353cb

See more details on using hashes here.

File details

Details for the file md_redact-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: md_redact-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 2.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.9.7 Darwin/21.2.0

File hashes

Hashes for md_redact-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c9bc8388104e0db16fdc6df33b72083ca5b4b91ac3699bd8ca2c44dd153d421f
MD5 6b09483ec752aece398c3db053a464da
BLAKE2b-256 3f8c2b3692e5f40e0e33c57150a8f5ff76178e0498f4c4c94dfffa2f9bf631ca

See more details on using hashes here.

Supported by

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