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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91867e14a5afda040a9f0be4b588f9c43fd95d39207ea8f68ffc1cf9da542b49
|
|
| MD5 |
820f8bb16d7624d0322882767bad7b3c
|
|
| BLAKE2b-256 |
7a4959f717e7d51e5c0ca544d339eef4909cfb1c777464456117ec4625d353cb
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9bc8388104e0db16fdc6df33b72083ca5b4b91ac3699bd8ca2c44dd153d421f
|
|
| MD5 |
6b09483ec752aece398c3db053a464da
|
|
| BLAKE2b-256 |
3f8c2b3692e5f40e0e33c57150a8f5ff76178e0498f4c4c94dfffa2f9bf631ca
|