Cant use Ref with a Label using Sphinx doc

核能气质少年 提交于 2019-12-19 12:53:12

问题


I have a problem with using Sphinx-doc's Ref function, i put a label above a paragraph and then i try to link to that label from another doc but inside the same project.

The label i use in one document:

.. _hal_1k_1p:

And the Ref i try to use to link to that label:

:ref:`Link title hal_1k_1p`

But i only get this error message when building the doc:

WARNING: undefined label: link title hal_1k_1p (if the link has no caption the label must precede a section header)

What am i doing wrong?


回答1:


Okay, looking at :ref: you need to have this:

:ref:`Link title <ha1_1k_1p>` 

to link to that label.

Ensure you have angle brackets surrounding your label like so: <label>



来源:https://stackoverflow.com/questions/32345136/cant-use-ref-with-a-label-using-sphinx-doc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!