How to automatically create links to C++ classes in markdown using doxygen? - c++

I am working on C++11 project, and we use Doxygen to create nice html API documentation.
I noticed that when I write class name directly in hpp files, doxygen generates links to corresponding class.
But when I write same class name in *.md files, links are not generated.
Do I need to enable this in config or use special syntax to enable links?

I was able to generate links automatically when I replaced markdown code block with <code><pre>...</pre></code>:
// link to MyClass is not generated
\```C++
Doc is about MyClass...
\```
|
v
// link to MyClass is generated
<code>
<pre>
Doc is about MyClass...
</pre>
</code>
UPD: added backslash so that they are properly rendered on StackOverflow.

Related

Documenting classes with doxygen

I am trying to follow these doxygen examples, but nothing shows up. I run
doxygen Doxyfile, and check the index.html file, but nothing is there. Only stuff that is in my mainpage.dox file, nothing to do with any classes. Ideally I'd have a class list, with this particular class I documented in it.
Perhaps it's my file structure. Does Doxygen just recurisvely search the root directory, or does it look for files with a special tag?
I found that I had to use both the #class parameter, as well as a brief description of the Class before that class was listed in the Class section of my generated documentation.

generating subdocuments with doxygen

I have a large C++ software application documented with doxygen. How can I set it up so that I can generate subdocuments for specific classes? The classes are documented with in-source commenting, their own .dox files, and images/ directory. I need to be able to generate a standalone pdf file specific to a single class.
I can use grouping to identify what will be included in that subdocument, but how do I generate output for a single group?
If you have a specific .dox file per requested output entity, then all you need to do is define in that file as input the files declaring and defining that class.
Say for example you want an output only for class MyClass which is declared in file myclass.hpp and whose implementation is in myclass.cpp, then in myclass.dox, just add this:
INPUT = ./myclass.cpp \
./myclass.hpp
Of course, you can have different paths for .cpp and .hpp. Or you can document more than one class.
Then, run doxygen on that myclass.dox file.
Also watch out for the output folder name. For the html output, the default name is html so you might want to rename it to avoid mixing up all the different outputs. For example, you might want to add in the dox file something like:
HTML_OUTPUT = html_myclass

Reference Doxygen Class or Namespace list from \mainpage

We have our own \mainpage section defined for our Doxygen build and I want to have a link as part of this to the auto-generated Class Index page (classes.html) and Namespace List top level page (namespaces.html).
I've tried things like \ref namespaces and \ref classes but that doesn't work. Any idea what the magic tag is?
There are no symbolic names at the moment to refer to the overview pages.
If it is for HTML only you can do
Link to the class index
If you need something for other output formats as well, you can wrap the above in \htmlonly...\endhtmlonly and do something similar for the other output formats.

Doxygen globally defined reference links

In Doxygen you use reference links: define them separately and then refer to them from within the text.
/**
* This is a documentation. Here I link [std::string] to an external web page.
*
* The next line is the link definition:
*
* [std::string]: http://en.cppreference.com/w/cpp/string/basic_string "std::string documentation"
*/
However it seems that the link definition is seen only within the documentation block. It is not seen even on other documentation blocks on the same page.
I want to define some links once, and then use them everywhere (on different pages).
Is that possible?
Edit (follow-up question)
In order to achieve your aim I think your best bet is to make use of the ALIAS facility.
I have managed to set it up with alias like this:
ALIASES += std_string="std::string "
ALIASES += std_vector="std::vector "
And using it:
#std_string
#std_vector
Basically I have one alias for each link.
Can it be achieved with one alias with parameters? The use would be:
#std_ref std::string
#std_ref std::vector
The problem is that some sort of map is needed between the name (the parameter) and the link:
std::string -> http://en.cppreference.com/w/cpp/string/basic_string
std::vector -> http://en.cppreference.com/w/cpp/container/vector
I know it can be done if one parameter would be the different part of the link, like :
#std_ref std::string string/basic_string
#std_ref std::vector container/vector
But this is ugly, error prone and would require to check each time what the link should be.
It's worth noting that what you are currently using is the notation that comes only with Doxygen's support for Markdown - it's not the doxygen method for external links. The original Doxygen method is to insert an HTML link inline...
link text
... but that makes no difference to your original problem.
In order to achieve your aim I think your best bet is to make use of the ALIAS facility. The relevant manual page is here. Using them, you should be able to define an alias like std-string and have it insert the HTML link everywhere you use the alias.
ALIASES are set up in the doxyfile config file (in this section of the manual)
You could set up aliases manually for every C++ keyword, that you want to link to, but the better way to do this is to use the doxygen TAGFILES feature.
A tag file is basically a compact representation of the entities found in the external sources. Doxygen can both generate and read tag files.
To generate a tag file for your project, simply put the name of the tag file after the GENERATE_TAGFILE option in the configuration file.
To combine the output of one or more external projects with your own project you should specify the name of the tag files after the TAGFILES option in the configuration file.
Doxygen has a whole page dedicated to explaining how to link to external documentation
And cppreference.com has already setup a tag file for you with some basic instructions.
For the impatient:
Download File:cppreference-doxygen-web.tag.xml for linking directly to cppreference.com website.
Add this line to your Doxyfile:
TAGFILES += "location/of/cppreference-doxygen-web.tag.xml=http://en.cppreference.com/w/"

How can i use gantry object in chronoform?

I want to add css and js file in head. But my template is using gantry. So I need to use gantry object to add css and js. But this object is not accessible in my custom form code. I think my requireonce function can not include the file.
require_once('../../../../templates/rt_graffito/lib/gantry/gantry.php');
$gantry->init();
$gantry->addStyle('media/moo_rainbow/css/mooRainbow.css', 5);
$gantry->addScript('media/moo_rainbow/js/mooRainbow.js');
This is the code I am using in my chrono form. But it's not working.
I bet you can use core Joomla document object and gantry shall pick it up, try follow:
<?php
// ... some code here
$document = &JFactory::getDocument();
$document->addScript('media/moo_rainbow/js/mooRainbow.js');
$document->addStyleSheet( 'media/moo_rainbow/css/mooRainbow.css');
// ... other code
and documentation reference
http://docs.joomla.org/JDocument/addStyleSheet
http://docs.joomla.org/Adding_JavaScript