diff --git a/docs_zh-CN/_static/css/readthedocs.css b/docs_zh-CN/_static/css/readthedocs.css new file mode 100644 index 0000000000..9d5dec72d3 --- /dev/null +++ b/docs_zh-CN/_static/css/readthedocs.css @@ -0,0 +1,6 @@ +.header-logo { + background-image: url("../image/mmediting-logo.png"); + background-size: 142px 46px; + height: 46px; + width: 142px; +} diff --git a/docs_zh-CN/_static/image/mmediting-logo.png b/docs_zh-CN/_static/image/mmediting-logo.png new file mode 100644 index 0000000000..95b851a916 Binary files /dev/null and b/docs_zh-CN/_static/image/mmediting-logo.png differ diff --git a/docs_zh-CN/api.rst b/docs_zh-CN/api.rst index 191ad02732..de5d16d385 100644 --- a/docs_zh-CN/api.rst +++ b/docs_zh-CN/api.rst @@ -1,6 +1,3 @@ -API Reference -================= - mmedit.core -------------- .. automodule:: mmedit.core diff --git a/docs_zh-CN/conf.py b/docs_zh-CN/conf.py index 3e3d61919c..fed2e1da1c 100644 --- a/docs_zh-CN/conf.py +++ b/docs_zh-CN/conf.py @@ -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 ----------------------------------------------------- @@ -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'] @@ -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' @@ -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)