I am using JSDoc comments in a JS file and running JSDoc2MD to render those comments into a markdown readme.md file. I want to include code examples in my documentation using the @example tag from JSDoc. I'm having trouble with rendering a string with quotes.
In my JS comments I have:
/** @example
* // returns true
* yesNo("Do you like cheese?");
*/
This comment becomes the following in json:
{
"examples": [
"// returns true\nyesNo(\"Do you like cheese?\");"
]
}
I have a custom handlebars template setup that JSDoc2MD uses to generate the readme. In my handlebars template I have:
```js
{{#each examples}}
{{this}}
{{/each}}
```
The generated readme has the html name instead of quotation marks:
```js
// returns true
yesNo("Do you like cheese?");
```
So the markdown output looks good expect for the quotation marks:
// returns true
yesNo("Do you like cheese?");
Anyone else working with JSDoc2MD having this issue? Did I just type something wrong here?
this is a handlebars thing, try this:
```js
{{#each examples}}
{{{this}}}
{{/each}}
```
note the triple brackets around this
.. see here and look for "triple stash".