Skip to main content

Executes Python code in Markdown files and captures the output

Project description

markdown_code_exec

Execute Python code in Markdown files and captures the output

Copyright 2022 Sebastiaan Mathôt

Command-line usage

usage: markdown_code_exec.py [-h] [-i INPUT] [-o OUTPUT]

optional arguments: -h, --help show this help message and exit -i INPUT, --input INPUT input markdown file -o OUTPUT, --output OUTPUT output markdown file

Function reference

markdown_code_exec.parse_text(md)

Takes a str containing markdown text, finds code blocks in the markdown, executes these code blocks and captures the output, and then embeds the captured output in the markdown.

Parameters

  • md: str : The input markdown string

Returns

str The compiled markdown string

markdown_code_exec.parse_file(src, dst)

Takes a markdown input file, executes code blocks while capturing output and writes the result to a new output file.

src: str The full path to the input file dst: str The full path to the output file

License

GNU General Public License 3

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

markdown_code_exec-0.3.0.tar.gz (3.1 kB view hashes)

Uploaded Source

Built Distribution

markdown_code_exec-0.3.0-py3-none-any.whl (3.8 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