Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I omit the source links in JsDoc?

Tags:

jsdoc

jsdoc3

What's the easiest way to cause JsDoc to leave out the source links? Do I have to define my own template?

like image 616
jwl Avatar asked Jan 03 '14 15:01

jwl


People also ask

What is Template for in JSDoc?

JSDoc's default template provides several options that you can use to customize the appearance and content of generated documentation. To use these options, you must create a configuration file for JSDoc and set the appropriate options in the configuration file.

What is JSDoc comment?

JSDoc is a markup language used to annotate JavaScript source code files. Using comments containing JSDoc, programmers can add documentation describing the application programming interface of the code they're creating.

What is JSDoc in Nodejs?

JSDoc is an open source API documentation generator for Javascript. It allows developers to document their code through comments.


2 Answers

If you use the default template, then use a configuration file with templates.default.outputSourceFiles set to false. For instance:

{
    "templates": {
        "default": {
            "outputSourceFiles": false
        }
    }
}

You'd pass the path to this file to jsdoc using the -c option on the command line.

I don't see this option documented in any actual jsdoc documentation. I've found it mentioned in this issue and this one.

The template is the entity providing this functionality so if you use another template than the default one, you have to check its documentation to find whether there is a setting you can set to do this.

like image 166
Louis Avatar answered Oct 30 '22 13:10

Louis


In order to remove source file links, we need to create a file named jsdoc.json and add:

{
    "templates":{
      "default":{
        "outputSourceFiles":false
      }
    }
}

Then run:

jsdoc -c jsdoc.json calculator.js

Here calculator.js is the main file (your actual file that is going to be documented) and jsdoc.json is the configuration file. To run the configuration file I used –c option.

So, basically all you need to do is to just create a file called jsdoc.json and add the above mentioned code and save it. After saving run this command:

jsdoc -c jsdoc.json calculator.js
like image 26
Sampath Abhishek Avatar answered Oct 30 '22 14:10

Sampath Abhishek