sphinx customize css template from default theme 自訂default theme的css模板

來源:互聯網
上載者:User

python 文檔工具 sphinx 預設產生的表格在表現複雜內容的時候,
有點乏力。

表格的左右沒有線條很不整齊啊。。(個人意見)

其實,文檔裡面說的很清楚,如下地址:

http://sphinx.pocoo.org/latest/theming.html#static-templates

 

做法很簡單,在 conf.py 中,指定了

html_static_path = ['_static']

把從

C:\Python27\Lib\site-packages\Sphinx-1.1.3-py2.7.egg\sphinx\themes\default\static

這裡找到的

default.css_t 

拷貝到與 conf.py 相對路徑裡面的 _static 目錄裡面,最後填上這些內容。

table.docutils {    border: 3px solid;    border-collapse: collapse;}table.docutils td, table.docutils th {    border: 1px solid #aaa;    border-bottom: 1px solid #aaa;    padding: 1px 8px 1px 5px;}

 

 注意,貌似sphinx如果發現其它檔案都沒有更新,貌似不會檢測default.css_t檔案寫入。

最好同時touch 一下其它源檔案,重建html。

english version

1.

copy C:\Python27\Lib\site-packages\Sphinx-1.1.3-py2.7.egg\sphinx\themes\default\static\default.css_t workspace\project\doc\source\_static\

2.

append these text to `default.css_t`

table.docutils {    border: 3px solid;    border-collapse: collapse;}table.docutils td, table.docutils th {    border: 1px solid #aaa;    border-bottom: 1px solid #aaa;    padding: 1px 8px 1px 5px;}

3. re-generate html document.

make clean; make html

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.