forked from fuyufjh/md2zhihu
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3574b8e
commit a3e687b
Showing
6 changed files
with
348 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,56 @@ | ||
# md2zhihu | ||
Convert markdown to zhihu compatible format | ||
|
||
将markdown转换成 知乎 兼容的 markdown 格式 | ||
|
||
## Install | ||
|
||
```sh | ||
pip install md2zhihu | ||
``` | ||
|
||
## Usage | ||
|
||
```sh | ||
md2zhihu your_great_work.md | ||
``` | ||
|
||
这个命令将markdown 转换成 知乎 文章编辑器可直接导入的格式, 存储到 `_md2/your_great_work/your_great_work.md`. | ||
`-o` 选项可以用来调整输出目录. | ||
|
||
## Features | ||
|
||
- 公式转换: | ||
|
||
例如 | ||
|
||
``` | ||
$$ | ||
||X{\vec {\beta }}-Y||^{2} | ||
$$ | ||
``` | ||
|
||
$$ | ||
||X{\vec {\beta }}-Y||^{2} | ||
$$ | ||
|
||
转换成可以直接被知乎使用的tex渲染引擎的引用: | ||
|
||
``` | ||
<img src="https://www.zhihu.com/equation?tex=%7C%7CX%7B%5Cvec%20%7B%5Cbeta%20%7D%7D-Y%7C%7C%5E%7B2%7D%5C%5C" alt="||X{\vec {\beta }}-Y||^{2}\\" class="ee_img tr_noresize" eeimg="1"> | ||
``` | ||
|
||
md2zhihu 能自动识别block的公式和inline的公式. | ||
|
||
- 表格: 将markdown表格转换成html 以便支持知乎直接导入. | ||
|
||
- 图片: md2zhihu 将图片上传到github, 并将markdown中的图片引用做替换. | ||
|
||
- 默认命令例如`md2zhihu your_great_work.md`要求当前工作目录是一个git(作者假设用户用git来保存自己的工作), md2zhihu将建立一个随机分支来保存所有图片. | ||
|
||
- 也可以使用指定的git repo来保存图片, 例如: | ||
|
||
`md2zhihu your_great_work.md -r https://github.com/openacid/openacid.github.io.git `要求是对这个repo有push权限. | ||
|
||
## Limitation | ||
|
||
- 知乎的表格不支持table cell 中的markdown格式, 例如表格中的超链接, 无法渲染, 会被知乎转成纯文本. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
|
||
from .md2zhihu import main | ||
|
||
main() |
Oops, something went wrong.