After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 692162 - markdown fenced code block not parsed
markdown fenced code block not parsed
Status: RESOLVED FIXED
Product: doxygen
Classification: Other
Component: general
1.8.3.1
Other Linux
: Normal normal
: ---
Assigned To: Dimitri van Heesch
Dimitri van Heesch
Depends on:
Blocks:
 
 
Reported: 2013-01-21 01:46 UTC by Donald Tournier
Modified: 2013-05-19 12:36 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Donald Tournier 2013-01-21 01:46:10 UTC
# Overview:

Markdown fenced code block interpreted as normal text when indent is large (>4).


# Steps to Reproduce:

- Create file example.h with contents:
~~~~
namespace NS1 {
  namespace NS2 {

    //! My class to do blah.
    /*! This class does blah.
        Example usage:
        ~~~~
        MyClass bogus;
        bogus.some_function();
        ~~~~
     */
    class MyClass {
      public:
        MyClass();
    }

  }
}
~~~~

- Create Doxyfile:
$ doxygen -g

- Edit Doxyfile and set INPUT to example.h

- run doxygen:
$ doxygen


# Actual Result:

Detailed description section contains:

This class does blah. Example usage: ~~~~ MyClass bogus; bogus.some_function(); ~~~~


# Expected Result:

Text between '~~~~' lines should be interpreted as code and formatted as such.


# Version & Platform:

version 1.8.3.1, Arch Linux 64-bit


# Additional Information:

The example above can be made to behave correctly by: 

- removing some spaces before the first '~~~~' to reduce the indent to less than 4

- inserting a newline after the start of the main comment block as follows:

    /*! 
        This class does blah.
        Example usage:
        ~~~~
        MyClass bogus;
        bogus.some_function();
        ~~~~
     */

What happens in the original case is that in isFencedCodeBlock() (src/markdown.cpp, line 1319), the refIndent variable is zero (checked by modifying 1.8.3.1 source and printing out variable). 

The isFencedCodeBlock() function does not check for the start of the code block beyond an indent of 4+refIndent, as this seems to be handled by the indented markdown code block isCodeBlock() function. So reducing the indent allows the start of the fenced code block to be detected. 

When the newline is inserted at the start of the comment block, the refIndent is correct.
Comment 1 Dimitri van Heesch 2013-01-26 10:57:16 UTC
Confirmed. Should be fixed in the next subversion update.
Comment 2 Dimitri van Heesch 2013-05-19 12:36:01 UTC
This bug was previously marked ASSIGNED, which means it should be fixed in
doxygen version 1.8.4. Please verify if this is indeed the case. Reopen the
bug if you think it is not fixed and please include any additional information
that you think can be relevant.