別のファイルで定義されたセクションを参照するリンクを作成したい。
「 Python-Sphinx: Link to Section in external File 」で同様の質問を見つけましたが、「intersphinx」という拡張子があることに気付きました。そこで、この拡張機能を試してみましたが、うまくいきません (おそらく私の使い方が間違っているのでしょう)。
私は以下を試しました。
conf.py
extensions = ['sphinx.ext.todo', 'sphinx.ext.intersphinx']
...
intersphinx_mapping = {'myproject': ('../build/html', None)}
foo.rst
...
****************
Install Bar
****************
Please refer :ref:`Bar Installation Instruction<myproject:bar_installation>`
上記のマークアップで「Bar Installation Instruction」のようなリンクを作りたいです。
bar.rst
...
**************************
Installation Instruction
**************************
.. _bar_installation:
some text...
を実行するmake html
と、次の警告が表示され、リンクが作成されません。
foo.rst: WARNING: undefined label: myproject:bar_installation (if the link has no caption the label must precede a section header)
前もって感謝します。