svenevs / exhale

Automatic C++ library api documentation generation: breathe doxygen in and exhale it out.
BSD 3-Clause "New" or "Revised" License
222 stars 51 forks source link

LaTeX in \f$ swallows \n newlines #173

Closed drmoose closed 2 years ago

drmoose commented 2 years ago

The doxygen \n command inside a @param normally works, but when it appears next to an equation (\f$), the resulting HTML doesn't include the paragraph breaks it ordinarily would.

/**
 * This one will break because the math swallows the newline.
 * @param away The direction \f$\tan x\f$ \n in which you float.
 */
void something_with_parameters(float away);

Renders as

<p><strong>away</strong> – The direction <span class="math notranslate nohighlight">\(\tan x\)</span> 
 in which you float. </p>

image

The <linebreak/> is preserved by Doxygen, though:

<parameterdescription>
<para>The direction <formula id="0">$\tan x$</formula> <linebreak/>
 in which you float. </para>
</parameterdescription>

And renders correctly in the Doxygen html output:

image

I've pushed up the project I used to generate this example here on github. Screenshots were generated with Javascript blocked so mathjax rewriting the DOM wouldn't confuse the issue.

svenevs commented 2 years ago

Thanks for reporting @drmoose, sorry for the delay! I transferred the issue to breathe at https://github.com/michaeljones/breathe/issues/856, don't worry about not asking for help on the right repo -- the stack involved and which tool does what is very confusing for everyone.

Exhale creates a bunch of .rst docs that in most places use the breathe directives. This happens at a very early stage. Then sphinx invokes the builder (html, pdf, ebup, etc), and during the build asks breathe to transform the rst directive such as .. doxygenfunction:: foo into the final output you see.

So for issues related to final html output, it's usually something going on with breathe. But if there are problems on a File or Namespace page then that is probably exhale.

This repo is fairly low traffic, so if you have another error and don't know where to post it feel free to open here and I'll advise what I can or direct you to the best of my ability :slightly_smiling_face:

drmoose commented 2 years ago

:+1: It's slightly embarrassing because I do know the difference (and even briefly looked at the source code of Breathe to see whether this was something obvious & i could fire off a quick PR instead of the issue) and still posted to the wrong tracker because I can't keep the names straight. Thanks for the forward.