Multi-line comments inside jsDoc code examples

Viewed 1449

How can we use a multi-line comment inside a jsDoc example?

I want to include the following code snippet:

/**
* @example
*
* a.setConnection(/* connection details here */);
*
*/

The engine does not seem to like such code at all. I have tried using HTML special symbols, like +* connection details here *+, but jsDoc does not convert them into proper symbols.

How can we make it work?

1 Answers

As I discovered on my own, special symbols are not supported in jsDoc inside @example block. They work only inside inline code blocks, like this:

```js
a.setConnection(/* connection details here */);
```

outputs: a.setConnection(/* connection details here */);

But unlike @example, you cannot place an inline code block after everything, because it is inline, which means it will be somewhere before your @returns section.

Awkward, I know, but there is no other way.

Related