jsdoc-wmf-theme
A theme for JSDoc 3 conforming to the Codex design system. Forked from the default template for JSDoc 3, which uses the Taffy Database library and the Underscore Template library.
Example
See https://doc.wikimedia.org/Parsoid/master/ for a sample demo. 🚀
Install
$ npm install --save jsdoc-wmf-theme
Usage
In your jsdoc.json
file, add a template option.
"opts": {
"template": "node_modules/jsdoc-wmf-theme"
}
Options
This theme supports the following options:
"templates": {
"wmf": {
"maintitle": [string, overrides name from package.json],
"repository": [string, overrides repo from package.json],
"hideSections": ["Events"…]
// This could include Modules, Externals, Namespaces, Classes,
// Interfaces, Events, Mixins, and Tutorials. The sections added
// here will not be shown in the sidebar.
}
}
Place them anywhere inside your jsdoc.json
file.
Contributing
Contributions to the theme are welcome! See the JSDoc WMF theme board on Phabricator to view open tasks or open new tasks, bug reports, or requests.
Local development
These steps assume that you have Gerrit set up.
To set up a development environment, you'll need a repository that can generate JSDoc documentation, and this theme itself.
Initial setup
# Create a local folder
mkdir jsdoc-test
# Enter that new local folder
cd jsdoc-test
# Download a repository that uses JSDoc. Either MediaWiki core...
git clone ssh://yourUserName@gerrit.wikimedia.org:29418/mediawiki/core
# ...or OOJS (or another repo of your choosing).
git clone ssh://yourUserName@gerrit.wikimedia.org:29418/oojs/core
# Get the JSDoc theme
git clone --recurse-submodules ssh://yourUserName@gerrit.wikimedia.org:29418/jsdoc/wmf-theme
cd wmf-theme
npm install
cd ..
Point to your local theme
In your local repository that uses JSDoc, edit the JSDoc config file (either jsdoc.js
or
.jsdoc.json
) and change the template to ../wmf-theme
.
Build and view your local docs
Build the docs in your test repo and view the generated site in the browser. E.g. for MediaWiki
core, run npm run doc
in the root of the core repository. Then find the full path to your local
index.html
file, e.g. file://path-to-local-mediawiki-core/docs/js/index.html
, and open it in a
browser.
Writing styles
This theme uses Codex design tokens for CSS values. View the Codex docs to see all of the tokens available for use as CSS custom properties.
Thanks
Thanks to:
- The default JSDoc theme
- The Wikimedia User Interface Style Guide, on which this theme was originally based
License
Licensed under the Apache License, version 2.0.