Skip to main content

把 markdown 转换为知乎能正常导入的 markdown。支持自动处理图片、公式

Project description

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 都在一个公开的 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(失去维护)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zhihu_md-0.1.0.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zhihu_md-0.1.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file zhihu_md-0.1.0.tar.gz.

File metadata

  • Download URL: zhihu_md-0.1.0.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.7

File hashes

Hashes for zhihu_md-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c943092ee1ef0945d94f82a376232b149c5fd8b7e61c288754e9fc7dce53da59
MD5 c2489ec5a9be2f3f667041fb2ef249ec
BLAKE2b-256 fe94a67e66f8a617290c4b476b0d048d8f163490385b4378cc8c400e67d98cff

See more details on using hashes here.

File details

Details for the file zhihu_md-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: zhihu_md-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.7

File hashes

Hashes for zhihu_md-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ed4180506309f4bc16c026df3b0114238fb61038fcbaa0e78392a3c585426338
MD5 16617d4ed5e4cb57030c1428201eaf01
BLAKE2b-256 2b651bb4ebf29c44b1280ce4b16ad3f799c243b8384b17aaf6803950991ad008

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page