10

Question: I'm editing and using an open source javascript library that has JSDoc tags in its code. I was wondering if anyone knew of a JSDoc plugin that would allow me to generate a class diagram from the JSDoc tags.

Edit I decided to try out js/uml and found the following. The JS/UML eclipse extension requires an older version of Eclipse (Indigo) and a non-supported dependency library UML2tools. I found the dependencies needed and according to the Eclipse software manager installed correctly. When I tried to enable the uml functionality (having configured the js root), the process would hang. The examples that the group supplies points at single file Javascript. Seems to have trouble with multiple files being referenced.

4

2 回答 2

4

你可以使用 doxygen 工具,它提供了元数据来生成 uml 类图

http://plantuml.sourceforge.net/doxygen.html

于 2014-09-11T13:34:38.890 回答
3

不知道过去的 JSDoc 版本有什么能力,但 JSDoc 现在支持 Javascript 类和 extends 关键字。如果代码标记正确,JSDoc 可以理解类继承。

可以制作一个订阅 processingComplete 事件的 JSDoc 插件:“在 JSDoc 更新解析结果以反映继承和借用的符号后,将触发 processingComplete 事件。” http://usejsdoc.org/about-plugins.html

然后您可以遍历 Doclet(表示代码元素的对象)并序列化您自己的 JSON。然后,您可以为原始代码的 JSON 描述编写一个简单的 HTML 渲染器。

于 2017-07-05T04:42:58.183 回答