Metadata-Version: 2.4
Name: HOS_M2F
Version: 0.3.7
Summary: HOS M2F: Markdown→DOCX/PDF/XML/JSON + Mermaid/Matplotlib/Table→PNG
Author: security_hyacinth
License: MIT License
        
        Copyright (c) 2025 security_hyacinth
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://packaging.python.org/en/latest/tutorials/packaging-projects/
Keywords: docx,markdown,mermaid,playwright,diagram,export
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: python-docx>=0.8.11
Requires-Dist: playwright>=1.43
Requires-Dist: matplotlib>=3.7
Requires-Dist: reportlab>=3.6
Provides-Extra: publish
Requires-Dist: build>=1.0.0; extra == "publish"
Requires-Dist: twine>=5.0.0; extra == "publish"
Dynamic: license-file

# HOS_M2F

Markdown 多格式转换与图形渲染：支持 DOCX/PDF/XML/JSON，以及将 Mermaid/Matplotlib/表格渲染为图片（PNG）。

## 功能
- `Markdown → DOCX/PDF/XML/JSON`
- `Mermaid → PNG`
- 自动识别 `python/matplotlib` 代码块并生成图像
- 自动识别 Markdown 表格，优先渲染为 PNG，失败回退为结构或文本

## 安装
```bash
python -m pip install HOS_M2F
# 首次使用需安装浏览器内核
python -m playwright install chromium
```

## 命令行
- 点号脚本（推荐）：
  ```bash
  HOS_M2F.2docx input.md output.docx
  HOS_M2F.2pdf  input.md output.pdf
  HOS_M2F.2xml  input.md output.xml
  HOS_M2F.2json input.md output.json
  HOS_M2F.2png  input.mmd output.png
  ```
- 模块方式：
  ```bash
  python -m hos_m2f.md2docx_mermaid input.md output.docx
  python -m hos_m2f.md2pdf          input.md output.pdf
  python -m hos_m2f.md2xml          input.md output.xml
  python -m hos_m2f.md2json         input.md output.json
  python -m hos_m2f.render_mermaid  input.mmd output.png
  ```

## 使用提示
- Mermaid 块以三引号代码块标注：
  ```
  ```mermaid
  graph TD
    A --> B
  ```
  ```
- 若使用内联 Mermaid（不加代码块围栏），包也会自动检测并渲染。
- 识别 `python/matplotlib` 代码块并保存为 PNG；表格将优先渲染为 PNG，失败时在 XML/JSON 中以结构形式呈现，在 PDF 中以简洁文本呈现。

## 发布流程（PyPI/TestPyPI）
按照 Python Packaging 官方教程进行（Packaging Python Projects）。本项目已配置：
- `pyproject.toml` 使用 Setuptools 后端
- 入口脚本以 `HOS_M2F.2*` 点号样式注册
- `README.md` 与 `LICENSE` 纳入包元数据

### 本地构建
```bash
python -m pip install -U build twine
python -m build
```

### 上传到 TestPyPI（推荐先试跑）
- 使用 API Token 文件，例如 `c:\Users\LXCXJXHX\Desktop\QUESTION\PYPI.txt`，内容以 `pypi-` 开头。
- 通过脚本：
  ```powershell
  ./scripts/publish_testpypi.ps1 -TokenPath "c:\Users\LXCXJXHX\Desktop\QUESTION\PYPI.txt"
  ```
  脚本将使用用户名 `__token__` 和文件中的 Token 上传。

### 上传到 PyPI（正式）
```powershell
./scripts/publish_pypi.ps1 -TokenPath "c:\Users\LXCXJXHX\Desktop\QUESTION\PYPI.txt"
```
> 如果使用账户口令而非 API Token，可将脚本中的用户名参数改为你的用户名（示例：`security_hyacinth`），并以口令作为密码。

## 许可证
MIT License，详见 `LICENSE`。

## 致谢
- Python Packaging User Guide: Packaging Python Projects
- Playwright, python-docx, Mermaid
