https://docs.python.org/3/library/stdtypes.html#typecontextmanager
. 我正在尝试使用
:ref:
我跑了
python -m sphinx.ext.intersphinx https://docs.python.org/3/objects.inv
. 结果表明,除其他外:
...
std:label
23acks Acknowledgements : whatsnew/2.3.html#acks
23section-other Other Changes and Fixes : whatsnew/2.3.html#section-other
...
typebytearray Bytearray Objects : library/stdtypes.html#typebytearray
typebytes Bytes Objects : library/stdtypes.html#typebytes
typecontextmanager Context Manager Types : library/stdtypes.html#typecontextmanager
typeiter Iterator Types : library/stdtypes.html#typeiter
typememoryview Memory Views : library/stdtypes.html#typememoryview
...
intersphinx_mapping
intersphinx_mapping = {
'python': ('https://docs.python.org/3', None),
}
我使用以下指令:
:ref:`context manager <python:typecontextmanager>`
这似乎指向了正确的标签,但我得到了以下警告:
WARNING: undefined label: python:typecontextmanager (if the link has no caption the label must precede a section header)
:参考:
被字符串替换
context manager
我错过了什么?
注1
:ref:`with <python:with>`
,应该指向
https://docs.python.org/3/reference/compound_stmts.html#with
std:label
with The with statement : reference/compound_stmts.html#with
可能不是百分之百相关,但我可以链接到
:py:meth:`~contextmanager.__enter__`