jsdoc2md / dmd

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

can system helpers be overridden? #91

Closed augusttty closed 2 months ago

augusttty commented 1 year ago

I need to override system helpers, I override the default "link" helper by creating a plugin. But it didn't work.

75lb commented 2 months ago

I double-checked - the system helpers can be overriden. I created this file with overrides for two system helpers:

const overrides = {
  inlineLinks: function () {
    return 'some link text'
  },

  orphans: function () {
    return 'whatever'
  }
}

module.exports = overrides

I then ran dmd with the path to my custom helpers.

const output = await dmd(fixture, { helper: 'test/overrides/helpers.js' })
console.log(output)

The output looked as expected:

## Functions

<dl>
<dt><a href="#customFunction">customFunction()</a></dt>
<dd><p>some link text</p>
</dd>
<dt><a href="#firesError">firesError()</a></dt>
<dd><p>some link text</p>
</dd>
<dt><a href="#firesMany">firesMany()</a></dt>
<dd><p>some link text</p>
</dd>
<dt><a href="#firesDefinedEvent">firesDefinedEvent()</a></dt>
<dd><p>some link text</p>
</dd>

etc
etc

I override the default "link" helper by creating a plugin. But it didn't work.

It should have worked - could you post some example code please that fails to work correct, I will check it.

75lb commented 2 months ago

Closing this, I can't reproduce the issue - existing system helpers and partials can be overriden by passing in options.helper, options.partial or a plugin.. If you still have issues, please post some code I can run to reproduce and debug the issue.