Metadata-Version: 2.1
Name: nonebot-plugin-htmlrender
Version: 0.0.4.2
Summary: 通过浏览器渲染图片
License: MIT
Author: kexue
Author-email: xana278@foxmail.com
Requires-Python: >=3.7.3,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Requires-Dist: Pygments (>=2.10.0,<3.0.0)
Requires-Dist: aiofiles (>=0.8.0,<0.9.0)
Requires-Dist: jinja2 (>=3.0.3,<4.0.0)
Requires-Dist: markdown (>=3.3.6,<4.0.0)
Requires-Dist: nonebot-adapter-cqhttp (>=2.0.0-alpha.16,<3.0.0)
Requires-Dist: nonebot2 (>=2.0.0-alpha.16,<3.0.0)
Requires-Dist: playwright (>=1.17.2,<2.0.0)
Requires-Dist: pymdown-extensions (>=9.1,<10.0)
Requires-Dist: python-markdown-math (>=0.8,<0.9)
Description-Content-Type: text/markdown

# nonebot-plugin-htmlrender

* 通过浏览器渲染图片
* 可通过查看`example`参考使用实例

# ✨ 功能

* 通过html和浏览器生成图片
* 支持`纯文本` `markdown` 和 `jinja2` 模板输入 
* 通过 CSS 来控制样式



# 使用

参考[example/plugins/render/__init__.py](example/plugins/render/__init__.py)

## markdown 转 图片

- 使用 `GitHub-light` 样式
- 支持绝大部分 md 语法
- 代码高亮
- latex 数学公式 （感谢@[MeetWq](https://github.com/MeetWq)）
    - 使用 `$$...$$` 来输入独立公式
    - 使用 `$...$` 来输入行内公式
- 图片需要使用外部连接并使用`html`格式 否则文末会超出截图范围
- 图片可使用md语法 路径可为 `绝对路径`(建议), 或 `相对于template_path` 的路径

## 模板 转 图片

- 使用jinja2模板引擎
- 页面参数可自定义

# 🌰 栗子

[example.md](docs/example.md)
## 文本转图片（同时文本里面可以包括html图片）
![](docs/text2pic.png)

## markdown转图片（同时文本里面可以包括html图片）
![](docs/md2pic.png)

## 纯html转图片
![](docs/html2pic.png)

## jinja2模板转图片
![](docs/template2pic.png)


# 特别感谢

- [MeetWq](https://github.com/MeetWq) 提供数学公式支持代码和代码高亮
