基于 Playwright 的适用于 Graia 的文转图工具
Project description
Graiax Text2img Playwright 是一个基于 Graiax Playwright 的文转图工具, 其可以将纯文本、Markdown 或 JinJa2 的模板通过 Playwright 转换为图片。
安装
pdm add graiax-text2img-playwright
或 poetry add graiax-text2img-playwright
。
我们强烈建议使用包管理器或虚拟环境
开始使用
以下示例以 Ariadne 为例。
配合 Graia Saya 使用
from graiax.text2img_playwright import md2img
md = '''\
<div align="center">
# (WIP) Graiax Text2img Playwright
*(WIP) 基于 Playwright 的适用于 Graia 的文转图工具*
</div>
Graiax Text2img Playwright 是一个基于 [Graiax Playwright](https://github.com/GraiaCommunity/graiax-playwright) 的文转图工具,
其可以将纯文本、Markdown 或 JinJa2 的模板通过 Playwright 转换为图片。
## 安装
`pdm add graiax-text2img-playwright` 或 `poetry add graiax-text2img-playwright`。
> 我们强烈建议使用包管理器或虚拟环境
'''
@listen(FriendMessage)
async def function(app: Ariadne, friend: Friend):
image_bytes = await md2img(md, context_args={"viewport": {"width": 840, "height": 10}})
await app.sendMessage(friend, MessageChain(Image(data_bytes=image_bytes)))
预览
许可证
本项目使用 MIT
许可证进行许可。
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
Close
Hashes for graiax-text2img-playwright-0.1.0b3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ebb0ed57ba307f3476b347b3bf0c7dee543cf56d55bc21f68ab2defea1303de |
|
MD5 | dae64f7838a168c58b72f9bf39c927b0 |
|
BLAKE2b-256 | 92e9ec0f13f968a0dbd09344f963956c5d91e7378cbc385cf052439c89ae7296 |
Close
Hashes for graiax_text2img_playwright-0.1.0b3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e9bc8788189d8e895dec14a160674c556d3649203ad03954c7f13feb9e74a03 |
|
MD5 | 4219ed6dfb09b153895610b897ace723 |
|
BLAKE2b-256 | ff5b6a7976c6eeb576bfddfc754f06cc99b08fc8300da92e7af4c323f151e546 |