{"id":28899228,"url":"https://github.com/nonebot/plugin-htmlkit","last_synced_at":"2026-02-01T12:39:30.153Z","repository":{"id":288869015,"uuid":"969406041","full_name":"nonebot/plugin-htmlkit","owner":"nonebot","description":"Lite HTML renderer plugin for NoneBot2","archived":false,"fork":false,"pushed_at":"2026-01-31T13:13:50.000Z","size":10761,"stargazers_count":27,"open_issues_count":2,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2026-01-31T18:46:12.441Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nonebot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"open_collective":"nonebot","custom":["https://afdian.com/@nonebot"]}},"created_at":"2025-04-20T04:24:52.000Z","updated_at":"2026-01-31T03:51:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"371e03e3-ecfe-4a9d-b66f-de555788760b","html_url":"https://github.com/nonebot/plugin-htmlkit","commit_stats":null,"previous_names":["nonebot/plugin-htmlkit"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/nonebot/plugin-htmlkit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nonebot%2Fplugin-htmlkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nonebot%2Fplugin-htmlkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nonebot%2Fplugin-htmlkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nonebot%2Fplugin-htmlkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nonebot","download_url":"https://codeload.github.com/nonebot/plugin-htmlkit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nonebot%2Fplugin-htmlkit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28978179,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-01T12:13:08.691Z","status":"ssl_error","status_checked_at":"2026-02-01T12:13:08.356Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-21T08:08:37.827Z","updated_at":"2026-02-01T12:39:30.144Z","avatar_url":"https://github.com/nonebot.png","language":"C++","funding_links":["https://opencollective.com/nonebot","https://afdian.com/@nonebot"],"categories":[],"sub_categories":[],"readme":"# nonebot-plugin-htmlkit\n\n一个基于 [litehtml](https://github.com/litehtml/litehtml) 的轻量级 HTML 渲染插件。\n\n## 特性\n\n- 基于 [fontconfig](https://www.freedesktop.org/wiki/Software/fontconfig/) 的字体管理, 支持系统字体和自定义字体\n- 提供了 HTML，纯文本，markdown，和 Jinja2 模板渲染的快捷函数\n- 支持自定义图片和 CSS 的加载策略\n- 支持通过 CSS 控制样式\n- 支持自适应控制渲染宽度\n\n## 安装\n\n使用 [`nb-cli`](https://cli.nonebot.dev/) 安装：\n\n```bash\nnb plugin install nonebot-plugin-htmlkit\n```\n\n或者，使用你选择的 Python 包管理器工具安装 `nonebot-plugin-htmlkit` 即可。\n\n## 使用\n\n### API\n\n```python\nfrom nonebot import require\n\nrequire(\"nonebot_plugin_htmlkit\")\nfrom nonebot_plugin_htmlkit import (\n    text_to_pic,\n    md_to_pic,\n    template_to_pic,\n    html_to_pic,\n)\n```\n\n\u003e [!CAUTION]\n\u003e 注意：请先 `require(\"nonebot_plugin_htmlkit\")` 后再 `import` 插件！！！\n\n### 配置项\n\n`plugin-htmlkit` 的配置项主要为 [fontconfig](https://www.freedesktop.org/wiki/Software/fontconfig/) 的相关配置。\n\n对于 `FC/FONTCONFIG` 开头的配置项，请参考 [fontconfig 文档](https://www.freedesktop.org/software/fontconfig/fontconfig-user.html) 以了解更多。\n\n```python\n# ===============================\n# Fontconfig 配置\n# ===============================\n\n# FONTCONFIG_FILE\n# 用于覆盖默认的配置文件路径。\nFONTCONFIG_FILE: str\n\n# FONTCONFIG_PATH\n# 用于覆盖默认的配置目录。\nFONTCONFIG_PATH: str\n\n# FONTCONFIG_SYSROOT\n# 用于设置默认的 sysroot 目录。\nFONTCONFIG_SYSROOT: str\n\n# FC_DEBUG\n# 用于输出详细的调试信息。\n# 详细见 fontconfig 文档。\nFC_DEBUG: str\n\n# FC_DBG_MATCH_FILTER\n# 用于在调试时过滤特定模式。\n# 仅当 FC_DEBUG 设置为 MATCH2 时生效。\nFC_DBG_MATCH_FILTER: str\n\n# FC_LANG\n# 用于指定查询时的默认语言（弱绑定）。\n# 如果未设置，则从当前 locale 推导。\nFC_LANG: str\n\n# FONTCONFIG_USE_MMAP\n# 控制是否使用 mmap(2) 来处理缓存文件（如果可用）。\n# 值为布尔类型（yes/no, 1/0）。\n# 如果显式设置该变量，将跳过系统检查并强制启用或禁用。\nFONTCONFIG_USE_MMAP: str\n```\n\n### 构建说明\n\n1. [安装 Xmake](https://xmake.io/zh/guide/quick-start#installation)\n1. 初始化环境\n\n   使用 Xmake 时必须激活 Python 虚拟环境，并且安装 `build` 依赖组。\n\n   ```bash\n   # 拉取子模块\n   git submodule update --init --recursive\n   # 创建虚拟环境并安装依赖，同时避免直接构建项目\n   uv sync --no-install-workspace\n   # 激活虚拟环境，请使用对应 shell 的命令\n   source .venv/bin/activate\n   # 配置 Xmake 项目并安装依赖（由于有大量依赖需要通过源码编译安装，可能耗时较长）\n   xmake config -m releasedbg\n   ```\n\n1. 构建并安装\n\n   ```bash\n   # 构建\n   xmake build\n   # 安装\n   xmake install\n   # 安装到当前虚拟环境\n   uv sync --reinstall-package nonebot-plugin-htmlkit\n   ```\n\n   如果对 [litehtml](./litehtml) 做了修改，则需要重新构建它：\n\n   ```bash\n   xmake require --force litehtml\n   # 或者用以下更 dirty 但是快速的方法\n   rm -r build\n   xmake clean --all\n   # 重新构建并安装\n   xmake build\n   xmake install\n   uv sync --reinstall-package nonebot-plugin-htmlkit\n   ```\n\n#### 许可证\n\n本插件的 [Python 部分](./nonebot_plugin_htmlkit) 在 MIT 许可证下发布，[C++ 部分](./core) 在 LGPL-3.0-or-later 许可证下发布。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnonebot%2Fplugin-htmlkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnonebot%2Fplugin-htmlkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnonebot%2Fplugin-htmlkit/lists"}