0

I want a doxygen comment in my C++ code to refer to a certain function; say, in a different namespace: foo::bar(). And let's ignore the possibility that this function is overloaded. And I would also like the function's name to be set the same way as content within backticks in my doxygen comments.

With that in mind, which of the following are supposed to produce the effect I've described?

@ref foo::bar
@ref foo::bar()
@ref `foo::bar`
@ref `foo::bar()`

or - perhaps something else?

einpoklum
  • 118,144
  • 57
  • 340
  • 684

1 Answers1

0

The documentation of the \ref command states:

\ref ["(text)"]

Creates a reference to a named section, subsection, page or anchor. For HTML documentation the reference command will generate a link to the section. For a section or subsection the title of the section will be used as the text of the link. For an anchor the optional text between quotes will be used or if no text is specified. For LATEX documentation the reference command will generate a section number for sections or the text followed by a page number if refers to an anchor.

With the \ref command the first argument is the <name> and a <name> cannot contain a backtick.

To obtain the requested possibility of a mono spaced link one can for HTML (only!) adjust / extend the used entry in the style sheet.

As a starter:
In the default doxygen stylesheet doxygen.css we have:

a.el {
        font-weight: bold;
}

By changing this entry to e.g.

a.el {
        font-family: monospace, fixed;
        font-weight: normal;
}

Best is not to redefine the doxygen.css and give this as setting HTML_STYLESHEET, but create a new, extra, stylesheet and specify this in HTML_EXTRA_STYLESHEET.

Note that this will influence all links not only the \ref ones.

albert
  • 8,285
  • 3
  • 19
  • 32
  • Is `a.el` used only for links generated due to `@ref` or `@see`? Or also to other links? – einpoklum Feb 25 '21 at 15:05
  • Also for other links – albert Feb 25 '21 at 16:55
  • I see. So is there nothing I can do to change the style for a specific @ref/@see link? Or for a subset of them? – einpoklum Feb 25 '21 at 17:58
  • No not really, only create an enhancement request in the doxygen bug tracer. the only think one could think about is use and `ALIAS` in combination with `\htmlonly` or maybe `\anchor` but this would be very difficult and tricky and I'm not sure this would lead to a result. – albert Feb 26 '21 at 08:29