1

I'm trying to auto-generate a project's documentation using Sphinx. My project looks like:

project 
  |
  |_docs
    |_build
    |_source
  |_venv
  ...
  |_project
    |_backend
    |_frontend
      |_node_modules
      ...
      |_src

I've generated auto-documentation for backend, but I've got stuck when trying do it for javascript files in my project/project/frontend/src. I would like to use sphinx-js, but the command

make html

still generates documentation only for *.rst of python files.

I've install sphinx-js:

npm install jsdoc
pip install sphinx-js

and put this code in conf.py:

import os
import sys
sys.path.insert(0, os.path.abspath('../../project/backend/'))
sys.path.insert(0, os.path.abspath('../../'))

js_source_path = '../project/frontend/src/'

import django
os.environ['DJANGO_SETTINGS_MODULE'] = 'project.settings'
django.setup()

I've updated extensions:

extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.coverage',
'sphinx.ext.mathjax',
'sphinx.ext.ifconfig',
'sphinx.ext.viewcode',
'sphinx.ext.githubpages',
'sphinx_js'
]

Documentation includes only .py files, but now it can also see them in frontend/src (I checked it).

What did I wrong?

Ania
  • 51
  • 7
  • Suggest following the [Setup](https://github.com/erikrose/sphinx-js#setup) and [Use](https://github.com/erikrose/sphinx-js#use) sections of the project readme to discover the several steps you missed. – Steve Piercy Jul 12 '18 at 09:35
  • 1
    So I can't auto-generate all of these docs just by one click like .py files? – Ania Jul 12 '18 at 09:56
  • Docs don't write themselves, not even in Python. These tools provide a scaffold that is up to the author to populate with narrative. – Steve Piercy Jul 12 '18 at 11:54
  • Docs don't write themselves, but to be fair most documentation systems have the nice default behavior of parsing all objects of interest and formating a list of them, by categories. Most, but not Sphinx. Sphinx has a few plugins to do so (autosummary, for example), but Sphinx-js seems to miss one. – nojhan Jan 20 '22 at 13:24

0 Answers0