Sphinx 創造屬於自己的planet(doing)

如果沒有聽過Sphinx,Please Read The Fuck Documents(RTFD)。

Sphinx 展示:https://xiaer.readthedocs.io/en/latest/

Spinx 官網:http://www.sphinx-doc.org/en/master/

1.安裝sphinx

sudo apt-get install python-pip
sudo pip install sphinx sphinx_rtd_theme

安裝sphinx_rtd_theme 會使得你的文檔看起來更高大上,目前linux 主線文檔就使用的是這一款風格。

2.使用github或者gitlab來創建一個repo,clone到本地。

3.執行命令一直按回車,輸入書名,作者,version

sphinx-quickstart

4.修改主題風格:

cd source
vim conf.py
html_theme = ‘sphinx_rtd_theme’  修改主題風格

5. 展示自己的文檔:

https://readthedocs.org/ 這個網站能夠展示你代碼版本庫中的sphinx文件,同時提供download。

創建項目有兩種方式:1>.Connected Services + Import a Repo

2>. Import manually (在url中嵌入你的密碼。eg:https://sholck:[email protected]/sholck/my-book-Android-audio.git)

Documentation type選擇 Sphinx HtmlDir

6.編寫規範:注意 普通文本 與 格式文本 中間空行

嵌入其他頁面

Welcome to Sholck's documentation!
==================================

This is a planet for my flowers and dogs

.. toctree::
    :maxdepth: 2

    index/hello

嵌入圖片

hello-world
===========

心中有天地,不爲外物欺

.. figure:: 1.jpg
    :align: center

嵌入代碼文件(行數+着重顯示)代碼類型風格高亮尚未成功

耳機連接 日誌

.. highlight:: c

.. literalinclude:: doc/ear-conn.c
    :linenos:
    :emphasize-lines: 1-

目前存在的問題

1. 無法實現像https://www.kernel.org/doc/html/latest/sound/index.html 100%佔屏,所以導致一些代碼文件顯示時出現滑動條。

2.嵌入外部文件代碼無法高亮,使用下面的語句make html出錯。

:language: c
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章