目的
-
sphinx_rtd_theme
の横幅を広げる(など) - property属性が1行に詰め込まれてレイアウトされるのを防ぐ
仕掛け
docs/source/_static/css/custom_sphinx_rtd_theme.css
/*
* 「Sphinx の sphinx_rtd_theme をカスタマイズする」
* https://kuttsun.blogspot.com/2016/11/sphinx-sphinxrtdtheme.html
*/
.wy-nav-content {
max-width: 1600px;
}
h1,h2,h3,h4,h5,h6 {
border-bottom: 1px solid #ccc;
}
.wy-table-responsive table td, .wy-table-responsive table th {
white-space: normal;
}
colgroup {
display: none;
}
docs/source/_static/css/fix-layout-pyproperty.css
/*
* py:property's stacking on a single line on larger screen widths.
* https://github.com/readthedocs/sphinx_rtd_theme/issues/1301
*
* > Problem
* > Multiple properties I defined in the docs are all stacking on a single line.
* > (ドキュメントで定義した複数のプロパティがすべて1行に重なっている)
*
* https://github.com/readthedocs/sphinx_rtd_theme/issues/1301#issuecomment-1219961515
* https://gist.github.com/nocarryr/846301fd5c9083e2243346d19e55b5a3#file-override-css
*/
dl.py.property {
display: block !important;
}
-
sphinx-apidoc -F
コマンドで生成されるconf.py
に以下を設定
docs/source/conf.py
# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static']
html_css_files = ['css/custom_sphinx_rtd_theme.css', 'css/fix-layout-pyproperty.css']