成人国产在线小视频_日韩寡妇人妻调教在线播放_色成人www永久在线观看_2018国产精品久久_亚洲欧美高清在线30p_亚洲少妇综合一区_黄色在线播放国产_亚洲另类技巧小说校园_国产主播xx日韩_a级毛片在线免费

資訊專欄INFORMATION COLUMN

文檔生成器 mkdocs

hosition / 2889人閱讀

摘要:是一個(gè)對非常友好的文檔生成器,中文文檔地址使用我們可以用編寫自己的文檔,而且可以免費(fèi)部署到。資源中文數(shù)據(jù)結(jié)構(gòu)和算法教程類似生成文檔工具入坑指南配置文檔查詢工具支持?jǐn)?shù)學(xué)公式配置多個(gè)公眾號(hào)蘇生不惑

mkdocs 是 Python 一個(gè)對 Markdown 非常友好的文檔生成器,中文文檔地址

使用 mkdocs 我們可以用md 編寫自己的文檔,而且可以免費(fèi)部署到 GitHub 。

安裝

pip install mkdocs

使用
λ mkdocs.exe new mydoc
INFO    -  Creating project directory: mydoc
INFO    -  Writing config file: mydocmkdocs.yml
INFO    -  Writing initial docs: mydocdocsindex.md
λ cd mydoc

d:codemydoc
λ ls
docs/  mkdocs.yml

d:codemydoc
λ mkdocs serve
INFO    -  Building documentation...
INFO    -  Cleaning site directory
[I 190528 20:32:49 server:296] Serving on http://127.0.0.1:8000
[I 190528 20:32:49 handlers:62] Start watching changes
[I 190528 20:32:49 handlers:64] Start detecting changes
[I 190528 20:33:06 handlers:135] Browser Connected: http://127.0.0.1:8000/

編輯

vi docs/index.md
把 command 改為中文 命令 記得把文件改為 utf8 編碼,否則

INFO    -  Building documentation...
ERROR   -  Encoding error reading file: index.md
ERROR   -  Error reading page "index.md": "utf-8" codec can"t decode byte 0xc3 in position 92: invalid continuation byte
[E 190528 20:38:45 ioloop:801] Exception in callback >

刷新看到效果

vi mkdocs.yml
把site_name 的 my docs 改為中文 我的文檔

添加頁面

vi about.md
vi mkdocs.yml

site_name: 文檔
pages:
- [index.md, Home]
- [about.md, About]

然后報(bào)錯(cuò)了

INFO    -  Building documentation...
ERROR   -  Config value: "pages". Error: Invalid pages config. {} {, }
[E 190529 09:57:45 ioloop:801] Exception in callback >
    Traceback (most recent call last):
      File "d:pythonlibsite-packages	ornadoioloop.py", line 1229, in _run
        return self.callback()
      File "d:pythonlibsite-packageslivereloadhandlers.py", line 69, in poll_tasks
        filepath, delay = cls.watcher.examine()
      File "d:pythonlibsite-packageslivereloadwatcher.py", line 105, in examine
        func()
      File "d:pythonlibsite-packagesmkdocscommandsserve.py", line 107, in builder
        site_dir=site_dir
      File "d:pythonlibsite-packagesmkdocsconfigase.py", line 210, in load_config
        "Aborted with {0} Configuration Errors!".format(len(errors))
    mkdocs.exceptions.ConfigurationError: Aborted with 1 Configuration Errors!
λ mkdocs -V
mkdocs, version 1.0.4 from d:pythonlibsite-packagesmkdocs (Python 3.7)

查找到issue https://github.com/mkdocs/mkd...
https://www.mkdocs.org/user-g...
改為

site_name: 我的文檔
nav:
- 主頁: "index.md"
- 關(guān)于: "about.md"
theme: readthedocs

https://markdown-docs-zh.readthedocs.io/zh_CN/latest/

原來是中文文檔過時(shí)了。

生成秘鑰

cd ~/.ssh
ssh-keygen -t rsa -C “[email protected]
這里不要一路回車,我們自己手動(dòng)填寫保存路徑
vi config

Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/mysusheng
λ ssh -T [email protected]
Hi sushengbuhuo! You"ve successfully authenticated, but GitHub does not provide shell access.
站點(diǎn)生成
λ mkdocs build
INFO    -  Cleaning site directory
INFO    -  Building documentation to directory: d:codemydocsite

d:codemydoc
λ ls
docs/  mkdocs.yml  site/

一段時(shí)間后, 可能有文件被從源碼中移除了, 但是相關(guān)的文檔仍殘留在 site 目錄中. 在構(gòu)建命令中添加 --clean 參數(shù)即可移除這些文檔.

$ mkdocs build --clean

λ cd site

d:codemydocsite
λ ls
404.html  css/    img/        js/      search.html  sitemap.xml.gz
about/    fonts/  index.html  search/  sitemap.xml

d:codemydocsite
λ php -S localhost:8000
PHP 7.1.13 Development Server started at Wed May 29 10:17:19 2019
Listening on http://localhost:8000
部署到GitHub
λ git clone https://github.com/sushengbuhuo/markdown_doc
Cloning into "markdown_doc"...
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.

d:code
λ cd markdown_doc

d:codemarkdown_doc (master)
λ ls
README.md

d:codemarkdown_doc (master)
λ mkdir docs

d:codemarkdown_doc (master)
λ cd docs

d:codemarkdown_docdocs (master)
λ mkdocs.exe new .
INFO    -  Writing config file: .mkdocs.yml
INFO    -  Writing initial docs: .docsindex.md

d:codemarkdown_docdocs (master)
λ mkdocs build
INFO    -  Cleaning site directory
INFO    -  Building documentation to directory: d:codemarkdown_docdocssite

d:codemarkdown_docdocs (master)
λ echo "site/" >> .gitignore

d:codemarkdown_docdocs (master)
λ mkdocs gh-deploy --clean
INFO    -  Cleaning site directory
INFO    -  Building documentation to directory: d:codemarkdown_docdocssite
WARNING -  Version check skipped: No version specificed in previous deployment.
INFO    -  Copying "d:codemarkdown_docdocssite" to "gh-pages" branch and pushing to GitHub.
INFO    -  Your documentation should shortly be available at: https://sushengbuhuo.github.io/markdown_doc/

就是把site目錄代碼上傳到github gh-pages分支了.

瀏覽器訪問 https://sushengbuhuo.github.i... 看到效果了。

資源

Python 中文數(shù)據(jù)結(jié)構(gòu)和算法教程
類似gitbook生成文檔工具
Python Web 入坑指南
mkdocs配置
文檔查詢工具
支持?jǐn)?shù)學(xué)公式
git配置多個(gè)SSH Key

公眾號(hào):蘇生不惑

文章版權(quán)歸作者所有,未經(jīng)允許請勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。

轉(zhuǎn)載請注明本文地址:http://systransis.cn/yun/43938.html

相關(guān)文章

  • 不同用戶python path 權(quán)限問題

    摘要:問題背景用戶可以運(yùn)行但運(yùn)行則下列錯(cuò)誤經(jīng)過排查,發(fā)現(xiàn)是在某些的權(quán)限問題解決方法查看使用的代碼可知,使用的是查看路徑切換到用戶然后在命令行運(yùn)行路徑的權(quán)限修改路徑的權(quán)限發(fā)現(xiàn)有寫目錄是沒有執(zhí)行權(quán)限的。 問題背景 root 用戶可以運(yùn)行pip install mkdocs但gitlab-runner 運(yùn)行pip install mkdocs 則下列錯(cuò)誤 pip install mkdocs Tr...

    dack 評論0 收藏0
  • 蠎周刊 2015 年度最贊

    摘要:蠎周刊年度最贊親俺們又來回顧又一個(gè)偉大的年份兒包去年最受歡迎的文章和項(xiàng)目如果你錯(cuò)過了幾期就這一期不會(huì)丟失最好的嗯哼還為你和你的準(zhǔn)備了一批紀(jì)念裇從這兒獲取任何時(shí)候如果想分享好物給大家在這兒提交喜歡我們收集的任何意見建議通過來吧原文 Title: 蠎周刊 2015 年度最贊Date: 2016-01-09 Tags: Weekly,Pycoder,Zh Slug: issue-198-to...

    young.li 評論0 收藏0
  • 終于不用再苦逼地寫文檔了!教你如何生成可調(diào)試的API文檔

    摘要:本文寫的是什么平時(shí)總要寫文檔。所以,我所希望的事,就是在完成代碼后,可以費(fèi)很少的力氣,就生成一個(gè)像上文中所說的可調(diào)試文檔。我們接下來要做兩件事生成文檔文檔是可調(diào)試的文檔。一句話流程點(diǎn)擊生成按鈕,生成類的文檔。 本文寫的是什么? 平時(shí)總要寫文檔。不寫,代碼無法維護(hù),所以不得不寫。但是寫文檔費(fèi)時(shí)費(fèi)力,更可怕的是寫完了讀起來還很費(fèi)勁,束之高閣,總感覺時(shí)間浪費(fèi)掉了,真是苦不堪言。 一直以來深受...

    SegmentFault 評論0 收藏0

發(fā)表評論

0條評論

閱讀需要支付1元查看
<