可作为函数调用的Markdown渲染图片插件
Project description
📖 介绍
可作为函数调用的Markdown渲染图片插件
直接作为插件使用
安装并配置好插件后,无需额外导入函数,直接在群聊中发送指令即可使用。例如:
发送 md2img # 标题\n\n这是一段**粗体**文本。,即可收到渲染后的图片。
作为函数调用
你可以直接导入并使用渲染函数:
from nonebot_plugin_markdown2img.renderer import render_markdown_to_base64
# or
# from src.nonebot_plugin_markdown2img.renderer import render_markdown_to_base64
# 渲染Markdown文本为base64图片
markdown_text = "# 标题\n\n这是一段**粗体**文本。"
base64_image = render_markdown_to_base64(markdown_text)
💿 安装
使用 nb-cli 安装
在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装nb plugin install nonebot_plugin_markdown2img
使用包管理器安装
在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令pip
pip install nonebot_plugin_markdown2img
pdm
pdm add nonebot_plugin_markdown2img
poetry
poetry add nonebot_plugin_markdown2img
conda
conda install nonebot_plugin_markdown2img
打开 nonebot2 项目根目录下的 pyproject.toml 文件, 在 [tool.nonebot] 部分追加写入
plugins = ["nonebot_plugin_markdown2img"]
⚙️ 配置
在 nonebot2 项目的.env文件中添加下表中的必填配置
| 配置项 | 必填 | 默认值 | 说明 |
|---|---|---|---|
| font_path | 否 | 无 | 字体文件路径 |
| disable_gpu | 否 | True | 是否禁用Gpu |
🎉 使用
指令表
| 指令 | 权限 | 需要@ | 范围 | 说明 |
|---|---|---|---|---|
| md2img | 群员 | 否 | 群聊 | md2img + 想要生成图片的markdown文本 |
效果图
🙏 特别感谢
感谢 nonebot_plugin_easymarkdown 项目提供的灵感和参考。
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 nonebot_plugin_markdown2img-0.0.1.tar.gz.
File metadata
- Download URL: nonebot_plugin_markdown2img-0.0.1.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92226429374e3437cbb743b7ca7a3bccc4a294bd74156d6a73111acff8fae69b
|
|
| MD5 |
ede4b25ea685f2ebd9e74dfba2dd53e6
|
|
| BLAKE2b-256 |
d401c8eba062860226167002ce66289da1c15494b8b869205d5af9fc88f5cd63
|
Provenance
The following attestation bundles were made for nonebot_plugin_markdown2img-0.0.1.tar.gz:
Publisher:
release.yml on ANGJustinl/nonebot_plugin_markdown2img
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nonebot_plugin_markdown2img-0.0.1.tar.gz -
Subject digest:
92226429374e3437cbb743b7ca7a3bccc4a294bd74156d6a73111acff8fae69b - Sigstore transparency entry: 634334304
- Sigstore integration time:
-
Permalink:
ANGJustinl/nonebot_plugin_markdown2img@9ebbfecf8e2b1ffeedd5a42f05073fbef18f55e5 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/ANGJustinl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9ebbfecf8e2b1ffeedd5a42f05073fbef18f55e5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file nonebot_plugin_markdown2img-0.0.1-py3-none-any.whl.
File metadata
- Download URL: nonebot_plugin_markdown2img-0.0.1-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e1d25dce69dbb339b619ba78604243c35fd3b6c3638c800f7e7c18f6067f8fe
|
|
| MD5 |
35fb9398473efba4ff64d7c417c062c1
|
|
| BLAKE2b-256 |
24239249b66d14f6f4796c4dffeaad3df8f5df1e7d3cb0cf7f29d170b19882d6
|
Provenance
The following attestation bundles were made for nonebot_plugin_markdown2img-0.0.1-py3-none-any.whl:
Publisher:
release.yml on ANGJustinl/nonebot_plugin_markdown2img
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nonebot_plugin_markdown2img-0.0.1-py3-none-any.whl -
Subject digest:
2e1d25dce69dbb339b619ba78604243c35fd3b6c3638c800f7e7c18f6067f8fe - Sigstore transparency entry: 634334312
- Sigstore integration time:
-
Permalink:
ANGJustinl/nonebot_plugin_markdown2img@9ebbfecf8e2b1ffeedd5a42f05073fbef18f55e5 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/ANGJustinl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9ebbfecf8e2b1ffeedd5a42f05073fbef18f55e5 -
Trigger Event:
push
-
Statement type: