sphinx-js可以查找类文档

发布于 2025-02-01 20:28:13 字数 1720 浏览 1 评论 0原文

我正在尝试设置sphinx_js,但我一直收到此错误:

~/test_sphinx_js$ sphinx-build  -b html docs/source/ docs/build/html/
Running Sphinx v4.4.0
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 1 source files that are out of date
updating environment: [new config] 1 added, 0 changed, 0 removed
reading sources... [100%] index                                                                                                                                                                                    
Sphinx error:
No documentation was found for object "SomeClass" or any path ending with that.

这是我的测试项目结构:

.
├── docs
│   ├── build
│   │   └── html
│   ├── make.bat
│   ├── Makefile
│   └── source
│       ├── conf.py
│       ├── index.rst
│       ├── _static
│       └── _templates
└── src
    └── SomeClass.js

这些是相关的设置和代码:

conf.py

[...]
extensions = ['sphinx_js']
js_source_path = '../../src'
primary_domain = 'js'
[...]

index.rst:

Welcome to SomeDocs's documentation!
====================================

.. toctree::
   :maxdepth: 2
   :caption: Contents:



Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

.. js:autoclass:: SomeClass

someclass.js:

/** Class representing something. */
export default class SomeClass {

    /**
     * Create class.
     * @param {string} name - The name of the object.
     * @param {string} type - The type of object.
     */
    constructor(name, type) {
        this.name = name;
        this.type = type;

    }
}

我必须缺少明显的东西,但我可以't缠绕我的头

I'm trying to setup sphinx_js but I keep receiving this error:

~/test_sphinx_js$ sphinx-build  -b html docs/source/ docs/build/html/
Running Sphinx v4.4.0
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 1 source files that are out of date
updating environment: [new config] 1 added, 0 changed, 0 removed
reading sources... [100%] index                                                                                                                                                                                    
Sphinx error:
No documentation was found for object "SomeClass" or any path ending with that.

this is my test project structure:

.
├── docs
│   ├── build
│   │   └── html
│   ├── make.bat
│   ├── Makefile
│   └── source
│       ├── conf.py
│       ├── index.rst
│       ├── _static
│       └── _templates
└── src
    └── SomeClass.js

and these are the relevant settings and code:

conf.py

[...]
extensions = ['sphinx_js']
js_source_path = '../../src'
primary_domain = 'js'
[...]

index.rst:

Welcome to SomeDocs's documentation!
====================================

.. toctree::
   :maxdepth: 2
   :caption: Contents:



Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

.. js:autoclass:: SomeClass

SomeClass.js:

/** Class representing something. */
export default class SomeClass {

    /**
     * Create class.
     * @param {string} name - The name of the object.
     * @param {string} type - The type of object.
     */
    constructor(name, type) {
        this.name = name;
        this.type = type;

    }
}

I must be missing something obvious but I can't wrap my head around it

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

作妖 2025-02-08 20:28:13

JS:Autoclass不知道如何解析“导出默认类...”。您可以在无需准备“导出默认值”的情况下声明您的类,如果您确实需要导出类,则可以在“类别声明”一类声明之后声明“导出默认的someclass”。

js:autoclass does not know how to parse 'export default class...'. You can declare your class without prepending 'export default' and after the the class declaration a separate line can declare 'export default SomeClass', if you really need to export the class.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文