问题
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.
回答1:
you can use doxygen tools , it provides metadata to generate uml class diagram
http://plantuml.sourceforge.net/doxygen.html
回答2:
Not sure what past versions of JSDoc were capable of but JSDoc now supports Javascript classes and the extends keyword. If code is marked up correctly JSDoc can understand class inheritance.
Could make a JSDoc plugin which subscribes to the processingComplete event: "The processingComplete event is fired after JSDoc updates the parse results to reflect inherited and borrowed symbols." http://usejsdoc.org/about-plugins.html
Then you can iterate over the Doclets (objects representing code elements) and serialize your own JSON out. Then you can write a simple HTML renderer for the JSON description of your original code.
来源:https://stackoverflow.com/questions/20664842/jsdoc-uml-diagram