documentationdoxygenrdoc

How to generate rdoc-style collapsable code sections?


I am creating internal documentation for a C++ project using Doxygen. I am having Doxygen include the source for methods, etc., but this makes the page kind of hard to scan. I'd like it to behave like rdoc and hide the source in a block that is collapsed by default.

I thought that HTML_DYNAMIC_SECTIONS might let me do this, but alas, the changelog says that option only affects diagrams and graphs.

Maybe I could do it by editing the LAYOUT_FILE?

Anyhow, smart people, how can I coerce Doxygen to generate collapsable code sections?


Solution

  • if includ[ing] the source for methods, etc, [...] makes the page kind of hard to scan, why don't you just link to it (SOURCE_BROWSER = YES) instead of including it (INLINE_SOURCES = YES)? this would make the pages easier to scan and faster to load, and the source would still be accessible (at the expense of one more source page load). depends on how often you actually need to access the source, i guess.

    that being said, there is a way to generate collapsible code sections (you will have to modify the source and recompile Doxygen, though):

        <div class="dynheader"><div class="dynsection">
        [collapsible section]
        </div></div>
    

    the implementation (or going the SOURCE_BROWSER route :)) is left as an exercise for the reader. good luck!

    oh, and if you should succeed with a patch, it would be great if you could submit it to dimitri so that he can include it in a future version. thanks!