jsdoc-to-markdown icon indicating copy to clipboard operation
jsdoc-to-markdown copied to clipboard

command-line option "template" requires a value.

Open lorenzoromagnoli opened this issue 2 years ago • 3 comments

Most time, when running the command to generate the doc with a custom template it fails throwing this error.

If I change the template file and run the command again it works but every time I rerun the script with the same template file I get the same error:

command-line option "template" requires a value.

this is my script "scripts": { "docs": "jsdoc2md \"./library/*.js\" > \"./docs/api.md\" -t \"./docs/api-template.hbs\"" },

and a very simple template

---
layout: default
title: api
nav_order: 5
---
# MLTK API
* * *
{{>main}}

lorenzoromagnoli avatar Feb 16 '23 13:02 lorenzoromagnoli

If I change the template file and run the command again it works

Hmm, sounds like a cache thing.. how about if you run jsdoc2md with the --no-cache flag?

75lb avatar Feb 16 '23 18:02 75lb

Any update?

75lb avatar Mar 05 '23 14:03 75lb

Unfortunately that does not seem to have any effect.

lorenzoromagnoli avatar Mar 08 '23 07:03 lorenzoromagnoli

I also have this issue. Running with --no-cache and doing a --clear don't fix it for me.

I do have some extra information though.

This issue only reproduces for me if my template starts with front-matter (i.e: ---). If I use a template that doesn't start with front-matter, everything is fine. Note the OP also has the same condition in their template file.

I think there is something about the parsed template starting with --.

I can also give you a stack trace:

Uncaught:
JSDOC_ERROR: The command-line option "template" requires a value.
    at ExplainSync.verifyOutput (/home/chris/repositories/github_chris48s/v8r/docs/node_modules/jsdoc-api/lib/jsdoc-command.js:106:19)
    at ExplainSync._runJsdoc (/home/chris/repositories/github_chris48s/v8r/docs/node_modules/jsdoc-api/lib/explain-sync.js:34:32)
    at ExplainSync.getOutput (/home/chris/repositories/github_chris48s/v8r/docs/node_modules/jsdoc-api/lib/explain-sync.js:12:21)
    at ExplainSync.execute (/home/chris/repositories/github_chris48s/v8r/docs/node_modules/jsdoc-api/lib/jsdoc-command.js:49:24)
    at Object.explainSync (/home/chris/repositories/github_chris48s/v8r/docs/node_modules/jsdoc-api/index.js:20:18)
    at JsdocToMarkdown.getJsdocDataSync (/home/chris/repositories/github_chris48s/v8r/docs/node_modules/jsdoc-to-markdown/index.js:131:21)
    at JsdocToMarkdown.getTemplateDataSync (/home/chris/repositories/github_chris48s/v8r/docs/node_modules/jsdoc-to-markdown/index.js:101:28)
    at JsdocToMarkdown.renderSync (/home/chris/repositories/github_chris48s/v8r/docs/node_modules/jsdoc-to-markdown/index.js:72:23)

Is there any extra info I could provide that might help?

chris48s avatar Aug 05 '24 18:08 chris48s