通过浏览器渲染图片
Project description
特性
- 统一渲染 API:
render_text/render_markdown/render_html/render_template - 支持本地与远程渲染(Remote Playwright WS / Remote Browser CDP)
- 支持模板变量资源解析(含 filehost 方案)
- 支持渲染链路遥测(可选接入 sentry / prometheus)
快速导航
安装
基础安装
uv add nonebot-plugin-htmlrender
可选能力
uv add "nonebot-plugin-htmlrender[filehost]"
uv add "nonebot-plugin-htmlrender[sentry]"
uv add "nonebot-plugin-htmlrender[prometheus]"
uv add "nonebot-plugin-htmlrender[filehost,sentry,prometheus]"
快速开始
from nonebot import require
require("nonebot_plugin_htmlrender")
from nonebot_plugin_htmlrender import render_markdown, render_template, render_text
async def demo() -> None:
img_text = await render_text("Hello, HTMLRender")
img_md = await render_markdown("# Title\n\n**Hello**")
img_tpl = await render_template(
"templates",
template_name="card.html",
templates={"name": "nonebot"},
)
更多使用方式请参考 API 文档。
配置与文档
用户文档
开发者文档
仓库协作文档
开发与测试
make prepare
make check
make test-ci
make test-local
make install-browser
make ruff-format
make ruff-check
make typecheck
make ty
make build-artifacts
远程联调 smoke test:
make remote-smoke
首次构建镜像、基础镜像变更或 pyproject.toml / uv.lock 变更后,再使用:
make remote-smoke-build
开发容器(代码挂载 + 远程 Playwright):
docker compose -f docker-compose.dev.yaml up --build -d
docker compose -f docker-compose.dev.yaml exec dev sh
FAQ
系统要求
Python 3.10 or higher.
Windows 11+, Windows Server 2019+ or Windows Subsystem for Linux (WSL).
macOS 14 Ventura, or later.
Debian 12, Debian 13, Ubuntu 22.04, Ubuntu 24.04, on x86-64 and arm64 architecture.
致谢
- nonebot(提供框架能力支持)
- MeetWq(数学公式与代码高亮相关支持)
- zhenxun-org/zhenxun_bot 与 MountainDash/nonebot-bison(感谢庞大用户群体提供的长期反馈)
- nonebot-plugin-filehost、nonebot-plugin-sentry、nonebot-plugin-prometheus(提供 filehost / sentry / prometheus 能力载入支持)
- nonebot/plugin-htmlkit(提供测试思路参考)
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_htmlrender-0.7.0.tar.gz.
File metadata
- Download URL: nonebot_plugin_htmlrender-0.7.0.tar.gz
- Upload date:
- Size: 1.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4176b2861999d0989416b8dc73c3c5c642aff31d27bcaf621ca1f85469eaa00
|
|
| MD5 |
f4d29f417c755e870ee340f4b2974ee1
|
|
| BLAKE2b-256 |
592b0a0ae641a47bb13c1bbac7e91175fcc539dacf5610e0db23f969465b19ea
|
Provenance
The following attestation bundles were made for nonebot_plugin_htmlrender-0.7.0.tar.gz:
Publisher:
publish.yml on kexue-z/nonebot-plugin-htmlrender
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nonebot_plugin_htmlrender-0.7.0.tar.gz -
Subject digest:
c4176b2861999d0989416b8dc73c3c5c642aff31d27bcaf621ca1f85469eaa00 - Sigstore transparency entry: 1818341523
- Sigstore integration time:
-
Permalink:
kexue-z/nonebot-plugin-htmlrender@40e5cd4b2485edeb31dcc14b0b48be8f2f93c3e5 -
Branch / Tag:
refs/tags/v0.7.0 - Owner: https://github.com/kexue-z
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@40e5cd4b2485edeb31dcc14b0b48be8f2f93c3e5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file nonebot_plugin_htmlrender-0.7.0-py3-none-any.whl.
File metadata
- Download URL: nonebot_plugin_htmlrender-0.7.0-py3-none-any.whl
- Upload date:
- Size: 1.1 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fa82dcb501ce94e52ed7678a7aa9ed80bbf3aa0f8c38828c13bd0787e44de8f
|
|
| MD5 |
e1dac94be49fb01cd7622ab2f1973f06
|
|
| BLAKE2b-256 |
50b894a6d15403c00ad970cdad1752cdeec5fa81d29509a88fb58e4c0eb2219c
|
Provenance
The following attestation bundles were made for nonebot_plugin_htmlrender-0.7.0-py3-none-any.whl:
Publisher:
publish.yml on kexue-z/nonebot-plugin-htmlrender
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nonebot_plugin_htmlrender-0.7.0-py3-none-any.whl -
Subject digest:
5fa82dcb501ce94e52ed7678a7aa9ed80bbf3aa0f8c38828c13bd0787e44de8f - Sigstore transparency entry: 1818341550
- Sigstore integration time:
-
Permalink:
kexue-z/nonebot-plugin-htmlrender@40e5cd4b2485edeb31dcc14b0b48be8f2f93c3e5 -
Branch / Tag:
refs/tags/v0.7.0 - Owner: https://github.com/kexue-z
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@40e5cd4b2485edeb31dcc14b0b48be8f2f93c3e5 -
Trigger Event:
push
-
Statement type: