Page MenuHomePhabricator

Add our own plugins to the theme
Closed, ResolvedPublic

Description

I'm trying to figure out if we can have the them provide certain plugins. This would be helpful, to distribute any plugins we want to run for all of our code.

Haven't found anything so far however.

Event Timeline

Similar questions came up as part of T250022

The prevalent technique for this seems to be to just add "node_modules/jsdoc-wmf-theme/plugins" as a plugins directory to your jsdoc.json

It's not the prettiest, but I guess it could work ?

Change 1011330 had a related patch set uploaded (by Alex Paskulin; author: Alex Paskulin):

[jsdoc/wmf-theme@master] plugins: Set up plugins directory

https://gerrit.wikimedia.org/r/1011330

Change 1011330 merged by jenkins-bot:

[jsdoc/wmf-theme@master] plugins: Set up plugins directory

https://gerrit.wikimedia.org/r/1011330

Using node_modules/jsdoc-wmf-theme/plugins works locally for me, and I haven't seen any other way to do it, so I think we should move forward with it. I've set up a plugins directory in the patch above. Once it gets released, I'll add this to the JSDoc wiki page:

Under "Example jsdoc.json file", add:

"node_modules/jsdoc-wmf-theme/plugins/betterlinks"

In a new section, add:

== Plugins ==

The example config on this page enables plugins offered by JSDoc as well as plugins offered by the JSDoc WMF theme:

; markdown (JSDoc)
: Supports Markdown formatting in descriptions
; summarize (JSDoc)
: Creates a summary field for each element based on its description
; betterlinks (WMF theme)
: Supports external links without a <code>@link</code> tag, Phabricator short links, and short forms of <code>@link</code>

Plugins are a great way to extend the functionality of JSDoc. You can contribute your own plugins to the theme by adding a file to the [[git:jsdoc/wmf-theme/+/refs/heads/master/plugins/|plugins directory]]. For more information about writing plugins, see the [https://jsdoc.app/about-plugins JSDoc documentation].