Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugins should be able to set default values for any setting #90

Open
DarrenPaulWright opened this issue Oct 8, 2019 · 5 comments
Open

Comments

@DarrenPaulWright
Copy link

I own the plugin https://github.com/DarrenPaulWright/dmd-readable where I remove the global index partial because I don't need it, but I would prefer to just change the default for global-index-format to "none" so other users can override it. If this is possible now, I couldn't find any documentation on it. Thanks!

@75lb
Copy link
Member

75lb commented Oct 8, 2019

Hi, apologies for the lack of docs on this subject.. in dmd, there is a helper called optionSet. In your plugin partials you can use the helper to force a particular option, like this:

{{optionSet "global-index-format" "none"~}}

See here for an example of optionSet usage in the jsdoc2md testbed. See here for the output.

@DarrenPaulWright
Copy link
Author

DarrenPaulWright commented Oct 9, 2019

Ok, I got that to work by adding {{optionSet "global-index-format" "none"~}} to main.hbs, but how would users of my plugin override this setting? Would they have to provide their own main.hbs with a different setting? I tried setting -g table in an npm script and it didn't work.

@DarrenPaulWright
Copy link
Author

I moved the setting to template.hbs, so that should work for now, but I still feel like a setting passed in through the cli should win over anything set with optionSet in any of the templates.

@75lb
Copy link
Member

75lb commented Oct 9, 2019

I still feel like a setting passed in through the cli should win

It should, and usually does. I think what you need is a means for plugin authors to set their own default values. I'll look into this, thanks for the input.

@DarrenPaulWright
Copy link
Author

Thanks!

@75lb 75lb transferred this issue from jsdoc2md/jsdoc-to-markdown Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants