Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use JSDoc for documentation #31440

Merged
merged 21 commits into from Nov 23, 2021
Merged

Use JSDoc for documentation #31440

merged 21 commits into from Nov 23, 2021

Conversation

jgraham
Copy link
Contributor

@jgraham jgraham commented Oct 29, 2021

The goal here is to address some complaints around the quality of the API documentation, and to make the docs easier to maintain going forward. To that end there are two big changes:

  • The addition of sphinx-js to enable adding JSDoc strings directly into the docs.
  • Conversion of the testharness and testdriver docs to use the JSDoc rather than repeating all the documentation in the markdown files as well as in the source.

There are also some incidential changes:

  • The readdition of a Dockerfile for generating docs. The wpt build-docs command is updated to optionally use this docker image, avoiding the need to install the js components locally.
  • The addition of sphinx-autoreload so that it's possible to work on the docs using a local server and have the output regenerated when the inputs change.

@jgraham
Copy link
Contributor Author

jgraham commented Nov 5, 2021

@jgraham jgraham closed this Nov 5, 2021
@jgraham jgraham reopened this Nov 5, 2021
docs/frontend.py Outdated Show resolved Hide resolved
docs/frontend.py Outdated Show resolved Hide resolved
docs/frontend.py Outdated Show resolved Hide resolved
docs/frontend.py Outdated Show resolved Hide resolved
docs/frontend.py Outdated Show resolved Hide resolved
docs/frontend.py Show resolved Hide resolved
@jgraham jgraham changed the title Update docs generation Use JSDoc for documentation Nov 8, 2021
@jgraham jgraham marked this pull request as ready for review November 8, 2021 19:05
@jgraham jgraham requested a review from Ms2ger November 8, 2021 19:10
@sideshowbarker sideshowbarker removed their request for review November 9, 2021 07:29
@foolip
Copy link
Member

foolip commented Nov 16, 2021

@jgraham there are conflicts to resolve here. I guess that this is ready for review apart from that though?

@jgraham
Copy link
Contributor Author

jgraham commented Nov 16, 2021

Yes, this is ready for review.

jgraham and others added 12 commits November 22, 2021 16:38
This adds a `--serve` option to `wpt build-docs` which will run a
local server. sphinx-autobuild is used so that the docs are
automatically rebuilt when relevant files change.
This extracts more of the documentation from the JSDoc comments in the
file itself and reorganises things a little so the documentation is
easier to navigate.
This extracts most of the documentation from the JSDoc comments rather
than maintaining it in two places.

Due to the limitations of sphinx-js, it seems like every command needs
to be included one-by-one in the docs. However that has the advantage
that we can give them some orgnaisation rather than just providing a
flat list of commands.

COPY ./package.json ./
RUN npm install .
ENV PATH=/app/node_modules/.bin:$PATH
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be necessary, but maybe npx could be used, at least if invoked from /app/.

docs/package.json Outdated Show resolved Hide resolved
resources/testharness.js Outdated Show resolved Hide resolved
jgraham and others added 2 commits November 23, 2021 12:40
Trying to run it in the parent seems to not work in npm 6.x
Co-authored-by: Philip Jägenstedt <philip@foolip.org>
I couldn't get sphinx-js to work with @name or @function, so it seems
to be easier just to make an actual wrapper function so the docs render correctly.
@jgraham jgraham merged commit 2c2855c into master Nov 23, 2021
@jgraham jgraham deleted the docs branch November 23, 2021 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants