conf.py 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. # Configuration file for the Sphinx documentation builder.
  2. #
  3. # This file only contains a selection of the most common options. For a full
  4. # list see the documentation:
  5. # https://www.sphinx-doc.org/en/master/usage/configuration.html
  6. # -- Path setup --------------------------------------------------------------
  7. # If extensions (or modules to document with autodoc) are in another directory,
  8. # add these directories to sys.path here. If the directory is relative to the
  9. # documentation root, use os.path.abspath to make it absolute, like shown here.
  10. #
  11. import os
  12. # import sys
  13. # sys.path.insert(0, os.path.abspath('.'))
  14. # -- Project information -----------------------------------------------------
  15. project = 'DragonOS'
  16. copyright = '2022-2024, DragonOS Community'
  17. author = 'longjin'
  18. # The full version, including alpha/beta/rc tags
  19. release = 'dev'
  20. # -- General configuration ---------------------------------------------------
  21. # Add any Sphinx extension module names here, as strings. They can be
  22. # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
  23. # ones.
  24. extensions = ['myst_parser', 'sphinx_multiversion']
  25. # Add any paths that contain templates here, relative to this directory.
  26. templates_path = ['_templates']
  27. # The language for content autogenerated by Sphinx. Refer to documentation
  28. # for a list of supported languages.
  29. #
  30. # This is also used if you do content translation via gettext catalogs.
  31. # Usually you set "language" from the command line for these cases.
  32. language = 'zh_CN'
  33. # List of patterns, relative to source directory, that match files and
  34. # directories to ignore when looking for source files.
  35. # This pattern also affects html_static_path and html_extra_path.
  36. exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
  37. source_suffix = ['.rst', '.md']
  38. # -- Options for HTML output -------------------------------------------------
  39. # The theme to use for HTML and HTML Help pages. See the documentation for
  40. # a list of builtin themes.
  41. #
  42. html_theme = 'sphinx_rtd_theme'
  43. html_context = dict()
  44. # Add any paths that contain custom static files (such as style sheets) here,
  45. # relative to this directory. They are copied after the builtin static files,
  46. # so a file named "default.css" will overwrite the builtin "default.css".
  47. html_static_path = ['_static']
  48. html_sidebars = {
  49. '**': [
  50. 'versioning.html',
  51. ],
  52. }
  53. myst_enable_extensions = [
  54. "amsmath",
  55. "colon_fence",
  56. "deflist",
  57. "dollarmath",
  58. "fieldlist",
  59. "html_admonition",
  60. "html_image",
  61. "replacements",
  62. "smartquotes",
  63. "strikethrough",
  64. "substitution",
  65. "tasklist",
  66. ]
  67. # sphinx-multiversion 指定哪个分支为 lastest 版本
  68. smv_latest_version = 'master'
  69. smv_released_pattern = r'^tags/.*$' # Tags only
  70. smv_tag_whitelist = r'^(V.*|v.*)$'
  71. smv_branch_whitelist = "master"
  72. # Define the canonical URL if you are using a custom domain on Read the Docs
  73. html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "")
  74. # Tell Jinja2 templates the build is running on Read the Docs
  75. if os.environ.get("READTHEDOCS", "") == "True":
  76. html_context["READTHEDOCS"] = True
  77. if os.environ.get("SPHINX_MULTIVERSION_GIT_COMMIT", "") != "":
  78. html_context["commit"] = os.environ["SPHINX_MULTIVERSION_GIT_COMMIT"]
  79. # 截取前 7 位 commit hash,如果长度不足则不截取
  80. if "commit" in html_context:
  81. html_context["commit"] = html_context["commit"][:7]