javascript Angularjs 如何生成 HTML 代码文档

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12841772/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 17:14:13  来源:igfitidea点击:

Angularjs How to generate HTML code Documentation

javascriptangularjsjsdoc

提问by alchemication

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? 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...

有没有人在记录/构建 angularjs 项目方面有任何经验,以便 JSDoc 可以以 HTML 格式生成漂亮的注释(用于您的指令、控制器、过滤器等)?目前,它使用 _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.? When ran JSDoc command line utility it covered only about 5% of my code in the HTML report...

更新:我的具体问题是:有没有办法为 angularjs 文档块生成 html 文档以涵盖所有控制器/指令/过滤器等?当运行 JSDoc 命令行实用程序时,它只覆盖了 HTML 报告中大约 5% 的代码......

Thanks!

谢谢!

采纳答案by Ben Lesh

EDIT: See John David Five's answerbelow

编辑:请参阅下面的约翰大卫五世的回答

My answer was much, much older and should no longer be accepted.

我的答案要旧得多,不应再被接受。

回答by John David Five

I have been working on a grunt plugin that utilizes AngularJS's documentation generation code. It follows their syntax and output. grunt-docular. The link shows documentation generation for the docular source as well as the original AngularJS source. It's configurable and extendible.

我一直在研究一个使用 AngularJS 文档生成代码的 grunt 插件。它遵循他们的语法和输出。咕噜咕噜的。该链接显示了文档源以及原始 AngularJS 源的文档生成。它是可配置和可扩展的。

Go to grunt-docularand find the install link for an example of creating your own documentation

转到grunt-dicular并找到安装链接,以获取创建您自己的文档的示例

回答by Amadu Bah

Build steps:

构建步骤:

Docs will be availiable at build/docsfolder. If you have PHP 5.5 you can view it with:

文档将在build/docs文件夹中可用。如果您有 PHP 5.5,您可以使用以下命令查看它:

  • cd build
  • php -S localhost:8000
  • view in browser: http://localhost:8000/docs/index.html
  • 光盘构建
  • php -S 本地主机:8000
  • 在浏览器中查看: http://localhost:8000/docs/index.html