1
votes

I am writing a C# library and would like to link to some classes' pages from my mainpage.md file. However, the only way I can get Doxygen to make the links out of the text in the mainpage is by writing the fully-qualified names of the classes (eg. com.mycompany.myproject.MyClass) in the mainpage, which is a little hard to read and a real pain to write repeatedly. I would like to be able to just write MyClass in the mainpage and have it link to com.mycompany.myproject.MyClass.

There is only one namespace in my project anyway: is there any way I can make the mainpage assume all names are implicitly within this namespace? At worst, is there a nice way to truncate the namespace from the class names during generation? Right now my best solution is to run over my HTML files with sed after running Doxygen to edit index.html myself.

2

2 Answers

1
votes

I finally found my answer in a comment at doxygen: how to create hyperlinks to class definitions from Mainpage.dox?.

Essentially, the answer was to change my mainpage.md file into a mainpage.dox file, and surround my mainpage with a namespace declaration, like so:

namespace com.mycompany.myproject {

/**
 * {mainpage text here}
 */
}

This makes the mainpage within the namespace, and instructed Doxygen to look in the right namespace for any class names mentioned in the mainpage body.

1
votes

Try using HIDE_SCOPE_NAMES:

HIDE_SCOPE_NAMES = YES

http://www.doxygen.nl/manual/config.html#cfg_hide_scope_names

If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen will show members with their full class and namespace scopes in the documentation. If set to YES the scope will be hidden.

So using this should allow:

com.mycompany.myproject.MyClass

to become:

 MyClass