Sphinx - Custom theme not working

◇◆丶佛笑我妖孽 提交于 2019-12-20 03:22:16

问题


I have my sphinx documentation set up and want to use a custom theme. I have read the theme instructions on the sphinx website: http://www.sphinx-doc.org/en/stable/theming.html, but it doesn't work.

I have my theme name the same as it is in the conf.py file and it is in a zip folder in the same directory, but i keep getting the following error:

Theme error:
no theme named 'tera' found (missing theme.conf?)
make: *** [html] Error 2

My conf.py code is:

html_theme = "tera"

html_theme_options = {

}

html_theme_path = ['.']

As per the instructions, I have got a theme.conf file in the .zip file along with everything else I need. Not sure how to fix.

In my theme.conf file I have:

[theme] 
inherit = basic 
stylesheet = css/Terra.css 
pygments_style = default 

File structure is as follows: Documents > Documentation >_themes. Inside themes I have a 'tera' folder and a 'tera.zip' file.

I've also tried just putting the tera.zip file in my documentation folder directly, so its in the same directory as the conf.py file and still no luck


回答1:


I currently had the same problem. My issue was that zip creates by default a directory inside the zip file, thus theme.conf is not in its root.

Doing

$ zip -r tera.zip tera/*

gives the following:

$ less tera.zip
... Name
... ----
... tera/theme.conf

where I truncated the uninteresting output (...). If you do however

$ cd tera
$ zip -r tera.zip *

the configuration file will be at the root and sphinx works.



来源:https://stackoverflow.com/questions/48321017/sphinx-custom-theme-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!