Using¶
Once Champollion installed, add it as an extension to your Sphinx configuration file and indicate the path to the Javascript source code:
# conf.py
extensions = [
"champollion"
]
js_source = "./relative/path/to/example"
All Javascript files within the js_source
structure path is parsed
when the sphinx builder is initiated, and all relevant information is fetched
within a configuration environment which includes the description for each
element.
See also
See also
For all directives, only one argument must be given which represents the identifier of the element to document. This identifier depends on the file structure hierarchy.
Let’s consider the following example:
# conf.py
js_source = "./example"
The identifier of a class named TestClass included in
./example/module/test.js
will be example.module.test.TestClass
. This
class element can be documented as follow:
*****************************
example.module.test.TestClass
*****************************
.. js:autoclass:: example.module.test.TestClass
Note
Champollion add all directives to the
Javascript domain.
The js:
prefix must then be used for each directive, or the following
line should be added to the Sphinx configuration file:
# conf.py
primary_domain = "js"
See also