Closed augusttty closed 2 months ago
I was able to achieve something like what you're looking for by modifying the built-in {{>sig-name}}
partial, which looks like this:
{{#if virtual}}*{{/if}}{{#with (parentObject)}}{{#if virtual}}*{{/if~}}{{/with~}}
{{#if name}}{{#sig~}}
{{{@depOpen}~}}
{{{@codeOpen}~}}
{{#if @prefix}}{{@prefix}} {{/if~}}
{{@parent~}}
{{@accessSymbol}}{{#if (isEvent)}}"{{{name}}}"{{else}}{{{escape name}}}{{/if~}}
{{#if @methodSign}}{{#if (isEvent)}} {{@methodSign}}{{else}}{{@methodSign}}{{/if}}{{/if~}}
{{{@codeClose}~}}
{{#if @returnSymbol}} {{@returnSymbol}}{{/if~}}
{{#if @returnTypes}} {{>linked-type-list types=@returnTypes delimiter=" \| " }}{{/if~}}
{{#if @suffix}} {{@suffix}}{{/if~}}
{{{@depClose}~}}
{{~/sig}}{{/if~}}
{{#if virtual}}*{{/if}}{{#with (parentObject)}}{{#if virtual}}*{{/if~}}{{/with~}}
Try this:
{{@parent~}}
) sig-name.hbs
jsdoc2md --partial sig-name.hbs --files *.js
Hopefully that helps.. Let me know if not.
But if you're still getting undesired side-effects (due to the fact {{>sig-name}}
is used in multiple places, you might need to make your edit context-aware.. e.g. only strip the parent on class members: (replace line 6 of the above with this)
{{#if (isClassMember)}}{{else}}{{@parent~}}{{/if~}}
By default, the instance method of a class output with a instantiate parent class name prefix on every method. When the className getting longer, or the methods getting too many , it seems unnecessary to give every "local" method a prefix. I expected to omit the parent name, and I do tried the partial and the helper, but none of theme can achieve without a sideEffect(the signature is shared).And I have to change the dmd the source code to achieve that.Can jsdoc2md add a configuration to achieve this? For example:
=>source:
=>default jsdoc2md output:
ChatService
Chat Service
Kind: global class
chatService.send()
send a message to a person
Kind: instance method of
ChatService
chatService.receive()
receiving message
Kind: instance method of
ChatService
=>expected output:
//...
send()
send a message to a person
Kind: instance method of
ChatService
receive()
receiving message
Kind: instance method of
ChatService