zhihu_md: 把 markdown 转换为知乎编辑器支持的格式,并自动处理好图片和公式
用法
# 安装
pip install zhihu_md -U
# 帮助
python -m zhihu_md --help # 或者 zhihu_md --help
# 使用
python -m zhihu_md your_markdown.md # 或者 zhihu_md xxx.md
# 自动生成 your_markdown_for_zhihu.md
- 如果包含本地图片,请确保图片和 markdown 文件都
git push到公开的 GitHub repo。 - zhihu_md 会自动通过 git remote -v 获取 GitHub repo 地址
- 然后把 markdown 中的本地 img 转换为知乎能访问的 GitHub 代理地址
原理
图片上传
- 知乎无法通过
https://github.com/{user-name}/{repo-name}/blob/main/img.png?raw=true这种 URL 形式上传 Github 图像 - 但可以走各式各样的 GitHub 镜像站 来中转 repo 中的 image URL
- 默认方案,用的
https://bgithub.xyz/,失效了可自行更换 GitHub 镜像站
- 默认方案,用的
- 这些 URL 只需让 知乎 服务器访问一次,就可以完成上传
相似项目
- Markdown4Zhihu(失去维护)
- 失去维护,不支持图片 (知乎无法访问 github 服务器) 和公式了
- Markdown4Zhihu 对 repo 中的 md file 和图片的文件结构有琐碎的要求。还有比较麻烦的配置步骤
- 本项目
zhihu_md是基于 Markdown4Zhihu 完善而来,改进如下:- 一键安装,无需配置
- 通过镜像站来支持 GitHub 图片上传
- 对文件结构无要求,更加灵活
- VSCode-Zhihu(失去维护)
- 作者放弃维护,已经无法登录和使用
Metadata
Release files for zhihu-md 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| zhihu_md-0.1.1.tar.gz | 9.0 kB | Without provenance | Details for zhihu_md-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| zhihu_md-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for zhihu_md-0.1.1-py3-none-any.whl |
Total release size: 18.0 kB
Release files / zhihu_md-0.1.1.tar.gz
| Download URL | zhihu_md-0.1.1.tar.gz |
|---|---|
| Size | 9.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4ee1af6a4af6c0d26f69b24202d9c8465af333a96febcaefd5a91eefbfe10b11
|
|
BLAKE2b-256 checksum How to use checksums |
f64cf4b046d4179a0d8121b0c4e64032ee02a3580417f276b58f9e60ed731dd6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.7
|
Release files / zhihu_md-0.1.1-py3-none-any.whl
| Download URL | zhihu_md-0.1.1-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1c6edb4ab584d768f8e3700a009ed02719475208b12b200eee88ad9e29001898
|
|
BLAKE2b-256 checksum How to use checksums |
6a95e73ad9208f24ff538d6dde844ae5a7d8662847801ca5a0a4aaf7afccc2c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.7
|
Security for zhihu-md 0.1.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.