Sphinx配置conf.py文件

Options for HTML output

  • 設(shè)置 Logo

    向conf.py中添加:

     # Html logo in drawer.
     # Fit in the drawer at the width of image is 240 px.
    html_logo = '_static/logo.png'
    

    注意:Logo靜態(tài)png圖片存儲在source/static目錄中。

    效果如圖:

    Image 2.png
  • 頁面布局

    向conf.py中添加:

    html_last_updated_fmt = '%b %d, %Y'
    html_domain_indices = True
    html_theme_path = ['mxtheme']
    html_theme = 'sphinx_materialdesign_theme'
    

    效果如圖:

    Image 5.png

    添加另一模板:

html_last_updated_fmt = '%b %d, %Y'
html_domain_indices = True
html_theme_path = ['mxtheme']
html_theme = 'sphinx_materialdesign_theme'


html_use_index = True
html_show_sphinx = True

效果如圖:

Image 8.png
  • 目錄頁需要修改index.rst,效果如圖:
Image 9.png

添加如下內(nèi)容:

html_theme_options = {
    # Specify a list of menu in Header.
    # Tuples forms:
    #  ('Name', 'external url or path of pages in the document', boolean, 'icon name')
    #
    # Third argument:
    # True indicates an external link.
    # False indicates path of pages in the document.
    #
    # Fourth argument:
    # Specify the icon name.
    # For details see link.
    # https://material.io/icons/
    'header_links' : [
        ('Home', 'contents', False, 'home'),
        ("A Company", "https://www.horizon.ai/?lang=en-US", True, 'launch'),
        ('Contact Us', "mailto:bd@horizon.ai", True, 'email')
    ],

    # Customize css colors.
    # For details see link.
    # https://getmdl.io/customize/index.html
    #
    # Values: amber, blue, brown, cyan deep_orange, deep_purple, green, grey, indigo, light_blue,
    #         light_green, lime, orange, pink, purple, red, teal, yellow(Default: indigo)
    'primary_color': 'indigo',
    # Values: Same as primary_color. (Default: pink)
    'accent_color': 'red',

    # Customize layout.
    # For details see link.
    # https://getmdl.io/components/index.html#layout-section
    'fixed_drawer': True,
    'fixed_header': True,
    'header_waterfall': True,
    'header_scroll': True,

    # Render title in header.
    # Values: True, False (Default: False)
    'show_header_title': False,
    # Render title in drawer.
    # Values: True, False (Default: True)
    'show_drawer_title': True,
    # Render footer.
    # Values: True, False (Default: True)
    'show_footer': False
}

效果如下:

Image 15.png
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

友情鏈接更多精彩內(nèi)容