jsdoc2md / dmd

The default output template for jsdoc2md
MIT License
39 stars 49 forks source link

Add group globals by helper #88

Open zanerock opened 3 months ago

zanerock commented 3 months ago

Adds a groupGlobalsBy(groupFields, options) helper function. See #87 for use case/purpose. Also implemented a test, which necessitated (I believe) adding 'mock-require' as a dev dependency.

Closes #87

75lb commented 2 months ago

I will take a look, thanks.. In general, i try to avoid hard-coding personalisations (e.g. doMyRequiredThing()) into the stable core of a project - i prefer to offer extension points using which the user can add their own customisations, that's why it's possible to pass handlebars helpers into dmd.. however, I realise this dmd codebase is 10 years old and not straight-forward to work on - simplification required..

zanerock commented 2 months ago

Yeah, I tried to find a way to write the function into my own plugin (dmd-readme-api). The problem is I couldn't find a way to get access to the helper functions in the base 'dmd' package, so to get the groupGlobalsBy working, I would have to replicate a ton of helper methods.

I did think one could break the helper functions into a separate package like '@jsdoc2md/dmd-helpers' or something, and then 'dmd' and 3rd party plugin packages could use the helpers package as needed. I'd be happy to work on that, but of course it'd be your call if that makes sense or not.

And of course, I could be overlooking something.

75lb commented 2 months ago

The helpers did used to live in their own project, for code-sharing reasons, but got pulled into dmd as a simplification for one of many reasons (which I'll document at some point soon). Dmd/jsdoc2md was written in 2014, a lot has changed in JS since then.. Although next to nothing has changed in the jsdoc project - one of my main blockers (as a consumer of jsdoc data).

Will get back to you regarding groupGlobalsBy - it's next on my list..