Skip to content

Commit

Permalink
[Docs] Use PyTorch sphinx theme
Browse files Browse the repository at this point in the history
  • Loading branch information
Yshuo-Li committed Nov 4, 2021
1 parent e2893bb commit 8937e41
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 13 deletions.
6 changes: 6 additions & 0 deletions docs_zh-CN/_static/css/readthedocs.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.header-logo {
background-image: url("../image/mmediting-logo.png");
background-size: 142px 46px;
height: 46px;
width: 142px;
}
Binary file added docs_zh-CN/_static/image/mmediting-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions docs_zh-CN/api.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
API Reference
=================

mmedit.core
--------------
.. automodule:: mmedit.core
Expand Down
120 changes: 110 additions & 10 deletions docs_zh-CN/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
import subprocess
import sys

import pytorch_sphinx_theme
from m2r import MdInclude
from recommonmark.transform import AutoStructify

sys.path.insert(0, os.path.abspath('..'))

# -- Project information -----------------------------------------------------
Expand All @@ -33,22 +37,25 @@
'sphinx.ext.autodoc',
'sphinx.ext.napoleon',
'sphinx.ext.viewcode',
'sphinx_markdown_tables'
] # yapf: disable
'sphinx_markdown_tables',
'sphinx.ext.autosectionlabel',
'sphinx_copybutton',
]

autodoc_mock_imports = [
'mmcv._ext',
'mmcv.ops.modulated_deform_conv2d',
'mmcv.ops.ModulatedDeformConv2d',
'mmedit.version',
'skimage'
] # yapf: disable
'mmedit.version', 'skimage', 'mmcv.ops.ModulatedDeformConv2d',
'mmcv.ops.modulated_deform_conv2d', 'mmcv._ext'
]

source_suffix = {
'.rst': 'restructuredtext',
'.md': 'markdown',
}

# Ignore >>> when copying code
copybutton_prompt_text = r'>>> |\.\.\. '
copybutton_prompt_is_regexp = True

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

Expand All @@ -62,12 +69,95 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
# html_theme = 'sphinx_rtd_theme'
html_theme = 'pytorch_sphinx_theme'
html_theme_path = [pytorch_sphinx_theme.get_html_theme_path()]

html_theme_options = {
# 'logo_url': 'https://mmocr.readthedocs.io/en/latest/',
'menu': [
{
'name': 'GitHub',
'url': 'https://github.com/open-mmlab/mmediting',
},
{
'name':
'算法库',
'children': [
{
'name': 'MMAction2',
'url': 'https://github.com/open-mmlab/mmaction2',
},
{
'name': 'MMClassification',
'url': 'https://github.com/open-mmlab/mmclassification',
},
{
'name': 'MMDetection',
'url': 'https://github.com/open-mmlab/mmdetection',
},
{
'name': 'MMDetection3D',
'url': 'https://github.com/open-mmlab/mmdetection3d',
},
{
'name': 'MMEditing',
'url': 'https://github.com/open-mmlab/mmediting',
},
{
'name': 'MMGeneration',
'url': 'https://github.com/open-mmlab/mmgeneration',
},
{
'name': 'MMOCR',
'url': 'https://github.com/open-mmlab/mmocr',
},
{
'name': 'MMPose',
'url': 'https://github.com/open-mmlab/mmpose',
},
{
'name': 'MMSegmentation',
'url': 'https://github.com/open-mmlab/mmsegmentation',
},
{
'name': 'MMTracking',
'url': 'https://github.com/open-mmlab/mmtracking',
},
]
},
{
'name':
'OpenMMLab',
'children': [
{
'name': 'Homepage',
'url': 'https://openmmlab.com/'
},
{
'name': 'GitHub',
'url': 'https://github.com/open-mmlab/'
},
{
'name': 'Twitter',
'url': 'https://twitter.com/OpenMMLab'
},
{
'name': 'Zhihu',
'url': 'https://zhihu.com/people/openmmlab'
},
]
},
]
}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = []
html_static_path = ['_static']
html_css_files = ['css/readthedocs.css']

myst_enable_extensions = ['colon_fence']

language = 'zh_CN'

Expand All @@ -82,3 +172,13 @@ def builder_inited_handler(app):

def setup(app):
app.connect('builder-inited', builder_inited_handler)
app.add_config_value('no_underscore_emphasis', False, 'env')
app.add_config_value('m2r_parse_relative_links', False, 'env')
app.add_config_value('m2r_anonymous_references', False, 'env')
app.add_config_value('m2r_disable_inline_math', False, 'env')
app.add_directive('mdinclude', MdInclude)
app.add_config_value('recommonmark_config', {
'auto_toc_tree_section': 'Contents',
'enable_eval_rst': True,
}, True)
app.add_transform(AutoStructify)

0 comments on commit 8937e41

Please sign in to comment.