我在sphinx
渲染shields.io
徽章时遇到了这个问题。我正在使用 sphinx 和 read-the-docs 模板。
index.rst
我想在我的文件中添加一系列徽章。这些 URL 在我的 README.md 中正确工作 - 在这里找到- 用 markdown 编写,并且在浏览器中打开它们时会显示正确的标记。
但是,当我在第一个文件中使用相同的链接时,看起来输出 html 从 shields.io 获取信息时出现了某种问题。徽章确实显示,但要么根本不获取信息(如 GitHubActions 构建和 CodeCov 覆盖徽章),要么获取正确的信息但不按要求呈现(例如,pypi 版本是橙色而不是蓝色)
这就是我的徽章在 index.html 中的呈现方式:
我的第一个如下(从 shields.io 网站的徽章编辑器复制粘贴条目):
.. image:: https://img.shields.io/pypi/pyversions/mplStrater :alt: PyPI - Python Version
.. image:: https://img.shields.io/pypi/v/mplStrater?makecolor=blue :alt: PyPI - Version
.. image:: https://img.shields.io/github/release-date/giocaizzi/mplStrater :alt: GitHub Release Date
.. image:: https://img.shields.io/github/workflow/status/giocaizzi/mplStrater/mplStrater/main :alt: GitHub Workflow Status (branch)
.. image:: https://img.shields.io/codecov/c/github/giocaizzi/mplStrater :alt: Codecov
.. image:: https://requires.io/github/giocaizzi/mplStrater/requirements.svg?branch=main
:target: https://requires.io/github/giocaizzi/mplStrater/requirements/?branch=main
:alt: Requirements Status
.. image:: https://img.shields.io/github/license/giocaizzi/mplStrater :alt: license
.. image:: https://img.shields.io/github/issues/giocaizzi/mplStrater :alt: issues
编辑:
只是为了添加更多上下文。我还运行了该make linkcheck
命令,并且所有 URL 都通过了。
( index: line 24) ok https://img.shields.io/github/issues/giocaizzi/mplStrater:alt:issues
( index: line 11) ok https://img.shields.io/github/release-date/giocaizzi/mplStrater:alt:GitHubReleaseDate
( index: line 21) ok https://img.shields.io/github/license/giocaizzi/mplStrater:alt:license
( index: line 15) ok https://img.shields.io/codecov/c/github/giocaizzi/mplStrater:alt:Codecov
( index: line 2) ok https://requires.io/github/giocaizzi/mplStrater/requirements.svg?branch=main
( index: line 9) ok https://img.shields.io/pypi/v/mplStrater?makecolor=blue:alt:PyPI-Version
( index: line 46) ok https://github.com/giocaizzi
( index: line 13) ok https://img.shields.io/github/workflow/status/giocaizzi/mplStrater/mplStrater/main:alt:GitHubWorkflowStatus(branch)
( index: line 5) ok https://img.shields.io/pypi/pyversions/mplStrater:alt:PyPI-PythonVersion
( index: line 2) ok https://requires.io/github/giocaizzi/mplStrater/requirements/?branch=main
我用于处理项目和构建文档的环境如下。对文档文档包的唯一严格要求是docutils=0.16
由于模板中的项目符号没有解决一个错误read-the-docs
(据我调查)。
name: geo
channels:
- defaults
- conda-forge
dependencies:
- python=3.7
- geopandas
- matplotlib
- numpy>=1.17
- pandas
- rasterio
- rio-color
- ipython
- ipykernel
- pytest
- pytest-cov
- sphinx
- sphinx_rtd_theme
- myst-parser
- nbsphinx
- docutils=0.16