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
md-redact-0.2.0.tar.gz
(2.8 kB
view hashes)
Built Distribution
Close
Hashes for md_redact-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9bc8388104e0db16fdc6df33b72083ca5b4b91ac3699bd8ca2c44dd153d421f |
|
MD5 | 6b09483ec752aece398c3db053a464da |
|
BLAKE2b-256 | 3f8c2b3692e5f40e0e33c57150a8f5ff76178e0498f4c4c94dfffa2f9bf631ca |