Skip to main content
NoneBotPluginLogo

NoneBotPluginText

nonebot-plugin-markdown2img

✨ 可作为函数调用的Markdown渲染图片插件 ✨

license pypi python

📖 介绍

可作为函数调用的Markdown渲染图片插件

注意
若你的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)

💿 安装

注意
若遇到缺少Markdown渲染图片失败,原因:Linkify enabled but not installed.. 请检查日志。报错, 请额外安装linkify-it-py或在.env文件中配置LINKIFY_ENABLED=false来禁用Linkify功能。

使用 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文件中添加下表中的必填配置

配置项 必填 默认值 说明
markdown2img_font_path 否 无 字体文件路径
markdown2img_disable_gpu 否 True 是否禁用GPU
markdown2img_disable_linkify 否 True 是否禁用Linkify

🎉 使用

指令表

指令 权限 需要@ 范围 说明
md2img 群员 否 群聊 md2img + 想要生成图片的markdown文本

效果图

test_markdown_output

🙏 特别感谢

感谢 nonebot_plugin_easymarkdown 项目提供的灵感和参考。

Metadata

Release files for nonebot-plugin-markdown2img 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nonebot-plugin-markdown2img 0.0.6
File Size Uploaded Provenance
nonebot_plugin_markdown2img-0.0.6.tar.gz 11.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for nonebot-plugin-markdown2img 0.0.6
File Interpreter ABI Platform
nonebot_plugin_markdown2img-0.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 23.5 kB

Release files / nonebot_plugin_markdown2img-0.0.6.tar.gz

Download URL nonebot_plugin_markdown2img-0.0.6.tar.gz
Size 11.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0097156b812cf6212781afd739e6ba99cc262b126b2f6fda6cf8b4318e56b63f
BLAKE2b-256 checksum
How to use checksums
b9b04f40a1b95fb5a6f7723f8608781ed0664e1f15f1555a36f1b5f3b79c662b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2025.

Transparency log

Release files / nonebot_plugin_markdown2img-0.0.6-py3-none-any.whl

Download URL nonebot_plugin_markdown2img-0.0.6-py3-none-any.whl
Size 12.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a268718613b0e6c7b106f2d07f126a221969fa17d38ec40e5de042a8b0e74c8b
BLAKE2b-256 checksum
How to use checksums
267ad4ff9e1bca8e66bdc8180cc4a561d63a05751a379181fd61e918b4c7b095
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2025.

Transparency log

Security for nonebot-plugin-markdown2img 0.0.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for nonebot_plugin_markdown2img-0.0.6.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page