Metadata-Version: 2.4
Name: mdproc
Version: 0.3.1
Summary: A tool to process markdown files.
Project-URL: Homepage, https://github.com/honghe/mdproc
Project-URL: Repository, https://github.com/honghe/mdproc
Author: Honghe
License-File: LICENSE
Keywords: jpg,markdown,png,process
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Multimedia :: Video
Requires-Python: >=3.10
Requires-Dist: cos-python-sdk-v5
Requires-Dist: httpx
Requires-Dist: markdown-it-py
Requires-Dist: playwright
Requires-Dist: python-dotenv
Provides-Extra: dev
Requires-Dist: build; extra == 'dev'
Requires-Dist: twine; extra == 'dev'
Description-Content-Type: text/markdown

# mdproc

A simple Python tool to process markdown files.

## Features

- Markdown Image Uploader to COS.
- Convert Markdown tables to images and upload to COS. (dependency: playwright)
- Convert mermaid chart to image.  (dependency: playwright)

## Config

`.env` or configure environment variables:

```
COS_SECRET_ID=<xyz>
COS_SECRET_KEY=<xyz>
COS_REGION=<xyz>
COS_BUCKET=<xyz>
```

## Usage

- Install dependencies:
  ```bash
  pip install mdproc
  playwright install chromium
  ```
- Markdown images upload:
  ```bash
  mdproc-imgupload your_markdown.md
  ```
- Markdown table to image:
  ```bash
   mdproc-table2img your_markdown.md
  ```
- Markdown mermaid to image:
  ```bash
   mdproc-mermaid2img your_markdown.md
  ```

## Demo

demo.md:

```
![first-version](https://www.python.org/static/img/python-logo.png)
```

demo_output.md

```
![first-version](https://pic-1251484506.cos.ap-guangzhou.myqcloud.com/imgs/python-logo_ae79195a.png)
```

## mermaid2img Benchmark

Note: Browser is Chromium. mermaid-cli use puppeteer.

| mermaid2img | Cold Start /s | Warm Start /s |
| --------------------------------- | ------------- | ------------- |
| playwright (memaidjs cdn) | 2.5 | 1.5 |
| playwright (local mermaid bundle) | 2.5 | 1.5 |
| mermaid-cli | 5.7 | 3.7 |

## License

Apache License
