-
Notifications
You must be signed in to change notification settings - Fork 107
Provide docs that explain how templates work #97
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
Comments
Any changes here since 2015? |
Any changes here since 2018? |
I was wondering the same thing. In one of the defect comments, there was mention of baseline: https://github.com/hegemonic/jsdoc-baseline - as far as I can tell, this uses Handlebars (.hbs) instead of Javascript template (.tmpl) files. But most of the JSDoc templates I've used still use .tmpl files. I'm working on making my own custom JSDoc template, and I've noticed a few things: It would be very cool if we could have a skeleton JSDoc Template with its own JSDoc-generated code files. (I am working on this myself, but it's a trial-and-error process...) If other users are interested in such a thing, perhaps we can start a repo and get people to contribute... ? |
I spent a little bit of my time by digging up default template and I have just found that the most of functionality of the It gets called by the cli command built in into JSDoc. So it's pretty simple. The primary function from https://github.com/jsdoc/jsdoc/blob/617b3236bf19d86763b8b046de174196b185594c/cli.js#L425-L441 try {
template = require(`${env.opts.template}/publish`);
}
catch (e) {
logger.fatal(`Unable to load template: ${e.message}` || e);
}
// templates should include a publish.js file that exports a "publish" function
if (template.publish && typeof template.publish === 'function') {
let publishPromise;
logger.info('Generating output files...');
publishPromise = template.publish(
taffy(props.docs),
env.opts,
resolver.root
); Hope someone finds this helpful. |
The great irony of providing a documentation system and not documenting it, this ticket has been open for 10 years, might be easier to work with the AST output instead. |
If you're trying to write a JSDoc template, we don't have much documentation that would help you figure out how to do that. In practice, most third-party templates have just forked the default template.
We should provide at least some high-level guidance on how you might go about writing a template.
The text was updated successfully, but these errors were encountered: