Pergunta

I am wanting to output examples which has HTML within it such as

* @example
*     <div ng-app="reportingBuilderApp">
*         <div ng-view></div>
*     </div>

But at the moment it renders it "safely" as HTML however I want it as text, at the moment I am needing to write the example as below (which is much more tedious and ugly in the actual JS)

* @example
*     &lt;div ng-app="reportingBuilderApp"&gt;
*         &lt;div ng-view&gt;&lt;/div&gt;
*     &lt;/div&gt; 

Is there any way of sorting JSDoc to prevent the HTML from being output "safely" automatically?

Foi útil?

Solução

Using version 3.3.0-alpha4, with the following test file:

/**
 * @example
 * <div ng-app="reportingBuilderApp">
 *     <div ng-view></div>
 * </div>
 */
function foo() {
}

I get an example that shows up correctly in the output of jsdoc.

As the name suggests, 3.3.0-alpha4 is still in alpha. To my knowledge there is no version previous to 3.3.0-alpha... which has the fix for this problem, and no workaround for it. The bug report that prompted the fix is here.

Outras dicas

There is no way to get around this. You will need to use HTML escape code if you want to show the < and > symbols in the final HTML JSDoc pages.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top