Python-Powered Markdown with executable code and dynamic content
Project description
PyExecMD: Python-Powered Markdown
PyExecMD is a revolutionary markup language that combines the simplicity of Markdown with the full power of Python. Write documents with executable code, dynamic content, and beautiful visualizations that update in real-time!
โจ Features
- ๐ Python-Based Syntax: Write markup using familiar Python function calls
- ๐ด Live Preview: Real-time rendering with auto-refresh as you edit
- ๐ Rich Visualizations: Built-in support for matplotlib, pandas, and other data science libraries
- ๐งฎ Dynamic Content: Execute Python code and display results inline
- ๐ฑ Beautiful Output: Clean, responsive HTML with modern styling
- โก Fast Rendering: Efficient parsing and rendering engine
- ๐ Auto-Refresh: Changes reflect immediately in the live preview
๐ Quick Start
Installation
Option 1: Install from PyPI (Recommended)
pip install pyexecmd
Option 2: Install from source
-
Clone the repository:
git clone https://www.github.com/treeleaves30760/PyMD cd PyMD
-
Install in development mode:
pip install -e .
Quick Test
pyexecmd serve example.pymd --port 8000
Basic Usage
-
Create a new PyExecMD document:
pyexecmd create my_document.pymd
-
Start live preview:
pyexecmd serve my_document.pymd --port 8000
Then open http://localhost:8000 in your browser
Note for macOS users: Port 5000 is often used by AirPlay. Use
--port 8000or another port to avoid conflicts. -
Render to HTML:
pyexecmd render my_document.pymd -o output.html
๐ PyExecMD Syntax
PyExecMD uses Python function calls to create content:
Headings
pymd.h1("Main Title")
pymd.h2("Section Title")
pymd.h3("Subsection Title")
Text
pymd.text("This is a paragraph of text.")
pymd.text("You can write **bold** and *italic* text too!")
Code Blocks
code_sample = '''
def hello_world():
print("Hello, PyExecMD!")
'''
pymd.code(code_sample, "python")
Images and Plots
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 10, 100)
y = np.sin(x)
plt.figure(figsize=(10, 6))
plt.plot(x, y)
plt.title("Sine Wave")
pymd.image(plt.gcf(), "Beautiful sine wave visualization")
Tables
import pandas as pd
df = pd.DataFrame({
'Name': ['Alice', 'Bob', 'Charlie'],
'Age': [25, 30, 35],
'Score': [95, 87, 92]
})
pymd.table(df)
๐ Project Structure
PyMD/
โโโ pymd/ # Main package directory
โ โโโ __init__.py # Package initialization
โ โโโ cli.py # Command-line interface
โ โโโ renderer.py # Core rendering engine
โ โโโ server.py # Live preview server
โโโ example.pymd # Example PyMD document
โโโ pyproject.toml # Package configuration
โโโ MANIFEST.in # Additional files to include
โโโ LICENSE # MIT License
โโโ requirements.txt # Python dependencies
โโโ README.md # This file
๐ ๏ธ API Reference
PyExecMD Class Methods
pymd.h1(text)- Create level 1 headingpymd.h2(text)- Create level 2 headingpymd.h3(text)- Create level 3 headingpymd.text(content)- Create paragraph textpymd.code(content, language)- Create code blockpymd.image(plot_obj, caption)- Render matplotlib plotspymd.table(data)- Render pandas DataFrames or tables
CLI Commands
# Create new PyExecMD file from template
pyexecmd create <filename> [--force]
# Start live preview server
pyexecmd serve <file> [--port PORT] [--host HOST] [--debug]
# Render PyExecMD to HTML
pyexecmd render <input> [-o OUTPUT]
๐ฏ Use Cases
- ๐ Data Science Reports: Combine analysis, visualizations, and explanations
- ๐ Interactive Documentation: Living documents that update with code changes
- ๐ Educational Materials: Tutorials with executable examples
- ๐ Dashboard Reports: Dynamic reports with real-time data
- ๐ฌ Research Papers: Academic papers with reproducible results
๐ Examples
Check out example.pymd for a comprehensive demonstration of PyExecMD features, including:
- Beautiful data visualizations
- Dynamic calculations
- Interactive tables
- Real-time updates
๐ค Contributing
We welcome contributions! Please feel free to submit issues, feature requests, or pull requests.
๐ License
This project is licensed under the MIT License.
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 pyexecmd-0.1.1.tar.gz.
File metadata
- Download URL: pyexecmd-0.1.1.tar.gz
- Upload date:
- Size: 18.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ac65f0323483d858c32ddc1dd305995a5a76983ead523e46e5b166f22a04e4c
|
|
| MD5 |
732ebb7837e7f42582bb680b276117c2
|
|
| BLAKE2b-256 |
526084a32cdd7f76fab4be4252eea32f2068c357617129fb54f67490f9ec59f0
|
File details
Details for the file pyexecmd-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pyexecmd-0.1.1-py3-none-any.whl
- Upload date:
- Size: 18.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd01ab0c67e5d1d94ac77bb52d4a15d6e2780ed0fe54081d9265baf3086b0fc0
|
|
| MD5 |
3eafad673154f0d3bd4c8aac3f86f918
|
|
| BLAKE2b-256 |
b4841722c6d003035b14b767355fcfe98656973e420bcb800950a0007df3f616
|