简体   繁体   English

Angularjs如何生成HTML代码文档

[英]Angularjs How to generate HTML code Documentation

Does anyone have any experience in documenting/structuring angularjs projects so the JSDoc can generate nice comments (for your directives, controllers, filters etc.) in an HTML format? 有没有人有任何记录/构造angularjs项目的经验,所以JSDoc可以生成HTML格式的好评论(对于您的指令,控制器,过滤器等)? At the moment it generates one file with the _global class that points to the namespace of my app with couple functions and that's it... 目前它使用_global类生成一个文件,该文件指向具有几个函数的应用程序的命名空间,就是这样...

Or maybe there is a better way to generate html version of doc blocks in angularjs? 或者也许有更好的方法在angularjs中生成HTML版本的doc块?

PS: I am using standard jsdoc syntax to document my code (@param, @return etc.) PS:我使用标准的jsdoc语法来记录我的代码(@ param,@ return等)

Update: My specific question is: Is there any way to generate html documentation for angularjs doc blocks to cover all controllers/directives/filters etc.? 更新:我的具体问题是:有没有办法生成angularjs doc块的html文档来覆盖所有控制器/指令/过滤器等? When ran JSDoc command line utility it covered only about 5% of my code in the HTML report... 当运行JSDoc命令行实用程序时,它只覆盖了HTML报告中约5%的代码...

Thanks! 谢谢!

I have been working on a grunt plugin that utilizes AngularJS's documentation generation code. 我一直在研究一个利用AngularJS文档生成代码的grunt插件。 It follows their syntax and output. 它遵循它们的语法和输出。 grunt-docular . grunt-docular The link shows documentation generation for the docular source as well as the original AngularJS source. 该链接显示了docular源的文档生成以及原始的AngularJS源。 It's configurable and extendible. 它是可配置和可扩展的。

Go to grunt-docular and find the install link for an example of creating your own documentation 转到grunt-docular并找到安装链接以获取创建自己的文档的示例

EDIT: See John David Five's answer below 编辑:请参阅下面的John David Five的答案

My answer was much, much older and should no longer be accepted. 我的答案很多,年纪都很大,不应再被接受了。

Build steps: 构建步骤:

Docs will be availiable at build/docs folder. 可以在build/docs文件夹中找到build/docs If you have PHP 5.5 you can view it with: 如果你有PHP 5.5,你可以用以下方法查看:

  • cd build cd build
  • php -S localhost:8000 php -S localhost:8000
  • view in browser: http://localhost:8000/docs/index.html 在浏览器中查看: http://localhost:8000/docs/index.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM