【问题标题】:How to import Markdown with Sphinx and myst-parser into Readthedocs?如何将带有 Sphinx 和 myst-parser 的 Markdown 导入 Readthedocs?
【发布时间】:2021-09-23 02:21:30
【问题描述】:

在我的docs/source/conf.py 我有这个代码:

extensions = [
    "sphinx.ext.autodoc",
    "myst_parser",
]
source_suffix = ['.rst', '.md']

我所有的文件都在 Markdown 中,而不是在 reStructuredText 中。

在 ReadTheDocs 上,初始构建在技术上是成功的,直到模块页面“未找到”并且索引页面完全空白。

我的.readthedocs.yaml

# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Build documentation in the docs/ directory with Sphinx
sphinx:
   configuration: docs/source/conf.py

# Optionally build your docs in additional formats such as PDF
formats: all

# Optionally set the version of Python and requirements required to build your docs
python:
  version: "3.8"
  install:
    - method: pip
      path: .
      extra_requirements:
        - docs

我的setup.cfg 包含以下内容:

[options.extras_require]
docs =
    sphinx
    myst-parser

当然,在docs/ 中执行make clean html 完全可以。不知道为什么 ReadTheDocs 无法正确链接到来自 index.md 的其余 .md 文件。

【问题讨论】:

  • 检查构建日志是否有错误。

标签: python-sphinx read-the-docs myst


【解决方案1】:

我解决了。我检查了构建日志,结果发现我有一些语法错误(我做了list[str] 而不是List[str]from typing import List

【讨论】:

    猜你喜欢
    • 2022-11-26
    • 2022-01-06
    • 2022-01-14
    • 2018-10-20
    • 2020-09-28
    • 1970-01-01
    • 1970-01-01
    • 2016-11-02
    • 1970-01-01
    相关资源
    最近更新 更多