Use Sphinx to generate standalone html files

老子叫甜甜 提交于 2020-01-25 07:33:27

问题


I'm quite new to Sphinx and I'm trying to create the docs for my application. It would be nice to generate a "standalone" html file for each topic.

I mean: Sphinx creates a useful navigation panel on the left, with some modules (toc, next topic, search, etc..). But this is placed in every html!

I would like to add a contextual help inside my application: whenever the user set the focus on a (relevant) widget, the related html is shown in a box. Of course I don't want to show the navigation panel here!

Is is possible to configure Sphinx to generate html files that contains ONLY the topic's content, then use a main html (index.html) to display them in a frame?


回答1:


The default HTML output (when using the html builder) includes a sidebar (navigation pane) for most themes, usually on the left hand side.

There are other output formats, such as HTML Help and Qt Help, with builders that produce HTML files without the sidebar. Use one of those.

The documentation for these builders says "this builder produces the same output as the standalone HTML builder...", but that is misleading IMHO. The output is not the same.




回答2:


This is what worked for me: https://stackoverflow.com/a/53212488/2636544, i.e. add following to conf.py:

html_theme_options = {
    # Disable showing the sidebar. Defaults to 'false'
    'nosidebar': True,
}

Works for alabaster theme.



来源:https://stackoverflow.com/questions/46633225/use-sphinx-to-generate-standalone-html-files

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