bkryza / clang-uml

Customizable automatic UML diagram generator for C++ based on Clang.
Apache License 2.0
610 stars 44 forks source link

Add option to automatically add element comments in diagrams #298

Open bkryza opened 3 months ago

bkryza commented 3 months ago

Currently, to add comments in class diagrams, it is necessary to add a jinja template, with a for loop iterating over all elements in the diagram, which is very convoluted.

There should be an option, similar to generate_message_comments in sequence diagrams, which would just generate diagrams with some sensible defaults for all elements which have a comments. There could be some simple options, such as:

generate_element_comments:
  brief: true # Only brief text from Doxygen comments, or none if no brief is provided (default false)
  max_length: 256 # Keep only 256 characters of a comment at maximum (0 - no limit - default)
  format: [as_is, auto] # In practice raw comment as extracted from code will look ugly
                        # in a diagram because of intendation, new lines, etc. `auto` option
                        # should process the comment to make it look better (if possible)