使用reStructuredText(rst)和Sphinx,有一种方法可以将所有引用(使用ref,doc等)的页面列表列为某个页面

时间:2020-06-22 20:07:56

标签: python-sphinx restructuredtext

例如,假设我具有以下项目结构

/features
 /foo
  index.rst
 /bar
  index.rst
/models
 foo.rst
 bar.rst

/foo/index.rst包含以下内容:

Foo Feature
***********

A nice explanation of the Foo feature

See :doc:`/models/foo`

/bar/index.rst包含以下内容:

Bar Feature
***********

A nice explanation of the Bar feature

See :doc:`/models/bar`

我希望能够同时向/models/foo.rst/models/bar.rst添加指令,以便在使用Sphinx进行渲染时,将生成指向功能页面的链接。

例如,我的/models/foo.rst可能包含以下内容:

class Foo {
 id: number;
 title: string;
}

.. magically-insert-back-links: // this is really what i'm looking for

并将呈现为:

class Foo {
 id: number;
 title: string;
}

Back Links:

- Foo Feature // and this text would be a link back to the Foo Feature page

0 个答案:

没有答案