Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSDoc adding real code in documentation

Do you know if there is some sort of <code /> tag in JSDoc? I need to add pieces of code in my documentation like this:

/**  * This function does something see example below:  *  * var x = foo("test"); //it will show "test" message  *  * @param {string} str: string argument that will be shown in message  */ function foo(str) {    alert(str); } 

I need the code in the comments to be displayed by JSDoc as code (if not syntax highlighted, at least like pre-formatted or something with grey background).

like image 341
Marco Demaio Avatar asked Jun 02 '10 20:06

Marco Demaio


People also ask

How do you write comments in JSDoc?

JSDoc comments should generally be placed immediately before the code being documented. Each comment must start with a /** sequence in order to be recognized by the JSDoc parser. Comments beginning with /* , /*** , or more than 3 stars will be ignored.


1 Answers

@example http://code.google.com/p/jsdoc-toolkit/wiki/TagExample

/**  * This function does something see example below:  * @example  * var x = foo("test"); //it will show "test" message  *  * @param {string} str: string argument that will be shown in message  */ function foo(str) {    alert(str); } 
like image 158
Josh Johnson Avatar answered Sep 28 '22 05:09

Josh Johnson