Skip to content

Newlines in non-verbatim output render as paragraphs #1028

@sethrj

Description

@sethrj

Quoting a paragraph in doxygen (see doxygen/doxygen#11586) erroneously propagates newlines to the XML output, even for non-verbatim text. Breathe then converts these newlines to paragraphs, resulting in <p></p> markers in HTML and new paragraphs in LaTeX.

Expected behavior

Single newlines, except in verbatim mode, should be discarded. Only the doxygen-generated <para> tags should result in paragraph separators in plain-text mode.

Example

//! \file example.h
/*!
 * \class Example
 *
 * \brief Example demonstrating erroneous output.
 *
 * The following paragraph has new paragraph markers internally when started
 * with a quote:
 *
 * "Lorem ipsum dolor sit amet,
 * consectetur adipiscing elit, sed do eiusmod tempor
 * incididunt ut labore et
 * dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
 * ullamco laboris nisi ut aliquip ex ea commodo consequat."
 *
 * But it's fine if the quote appears in the middle of a paragraph: "Lorem
 * ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
 * incididunt ut labore et dolore magna aliqua."
 *
 * "It doesn't matter if the paragraph end
 * is after" the final quotation: the newlines still appear.
 *
 * \"It's also fine
 * if using escaped quotes.\"
 *
 * Paragraphs without quotes are unaffected.
 *
 * Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
 * incididunt ut labore et dolore magna aliqua.
 */
class Example {};

with

# Doxyfile 1.12.0
GENERATE_XML           = YES
GENERATE_HTML           = NO
GENERATE_LATEX           = NO

and a minimal conf/rst

example documentation
=====================

.. doxygenclass:: Example

Renders as:

rendered-docs

because the XML contains newlines:

    <detaileddescription>
<para>The following paragraph has new paragraph markers internally when started with a quote:</para>
<para>&quot;Lorem ipsum dolor sit amet,
consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et
dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
ullamco laboris nisi ut aliquip ex ea commodo consequat.&quot;</para>
<para>But it&apos;s fine if the quote appears in the middle of a paragraph: &quot;Lorem
ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua.&quot;</para>
<para>&quot;It doesn&apos;t matter if the paragraph end
is after&quot; the final quotation: the newlines still appear.</para>
<para>"It&apos;s also fine if using escaped quotes."</para>
<para>Paragraphs without quotes are unaffected.</para>
<para>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. </para>
    </detaileddescription>

example.tgz

I've generated this minimal reproducing example from an example in my code's real-life documentation .
Image

Workaround

As the example shows, escaping the quotation marks should fix the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions