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 672656 - Images not copied when using ![caption](filename) image syntax in markdown files
Images not copied when using ![caption](filename) image syntax in markdown files
Status: RESOLVED FIXED
Product: doxygen
Classification: Other
Component: general
1.8.0
Other Linux
: Normal normal
: ---
Assigned To: Dimitri van Heesch
Dimitri van Heesch
Depends on:
Blocks:
 
 
Reported: 2012-03-22 21:50 UTC by Chris
Modified: 2012-05-19 12:26 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Bug demonstration files (46.92 KB, application/bzip2)
2012-03-22 21:50 UTC, Chris
  Details
Proposed patch against doxygen-svn rev 808 (1.38 KB, patch)
2012-03-23 11:38 UTC, Chris
none Details | Review

Description Chris 2012-03-22 21:50:02 UTC
Created attachment 210385 [details]
Bug demonstration files

Issue encountered when using doxygen 1.8.0 on gentoo linux.

When doxygen is processing markdown files, any images included in the page using the syntax

![caption](filename.png)

are not copied into the output documentation (it generates an <img> tag in the html as expected, but the image file is not copied into the output, and hence does not show when the page is viewed in the browser). However, using normal doxygen image syntax instead

@image html filename.ong "caption"

works as expected - the image is copied. I have attached a tarball containing two directories "working" and "broken". The contents of the two directories are identical, except for the contents of

working/mdfiles/structure.md     - uses doxygen syntax for the image
broken/mdfiles/structure.md      - uses markdown syntax

Steps to reproduce the problem are as follows. At a terminal prompt, issue:

$ tar xjf bugrep.tar.bz2
$ cd bugrep/working
$ doxygen
$ cd ../broken
$ doxygen 

Now view the documentation generated:

bugrep/broken/docs/webperl/appstructure.html - img tag present, but no image file
bugrep/working/docs/webperl/appstructure.html - image present and working

I note that, when processing the 'broken' tree, the following output may be significant:

$ doxygen -d markdown
Searching for include files...
Searching for example files...
Searching for images...
Searching for files in directory /home/chris/bugrep/broken/mdfiles
Searching for dot files...
Searching for msc files...
Searching for files to exclude
Searching for files to process...
Searching for files in directory /home/chris/bugrep/broken
Searching for files in directory /home/chris/bugrep/broken/docs
Searching for files in directory /home/chris/bugrep/broken/mdfiles
Reading and parsing tag files
Reading /home/chris/bugrep/broken/mdfiles/structure.md...
======== Markdown =========
---- input ------- 
![directory structure](filestructure.png)
---- output -----
<img src="filestructure.png" alt="directory structure"/>
---------
Comment 1 Chris 2012-03-23 11:38:36 UTC
Created attachment 210405 [details] [review]
Proposed patch against doxygen-svn rev 808

I have attached a proposed patch that modifies markdown.cpp so that it always generates @image when processing the markdown syntax images. This is a patch against a copy of the SVN tree checked out this morning.
Comment 2 Dimitri van Heesch 2012-03-24 11:55:42 UTC
Hi Chris,

Thanks for the patch, but it should also be possible to use a URL or relative path to an image outside of the doxygen tree. So I propose the following patch.
Let me know if it works for you.

--- doxygen-svn/src/markdown.cpp	2012-03-17 21:38:24.000000000 +0100
+++ markdown.cpp	2012-03-24 12:48:58.000000000 +0100
@@ -750,11 +750,14 @@
   }
   else if (isImageLink) 
   {
-    if (link.find("@ref ")!=-1 || link.find("\\ref ")!=-1) 
-        // assume doxygen symbol link
+    bool ambig;
+    FileDef *fd=0;
+    if (link.find("@ref ")!=-1 || link.find("\\ref ")!=-1 ||
+        (fd=findFileDef(Doxygen::imageNameDict,link,ambig))) 
+        // assume doxygen symbol link or local image link
     {
       out.addStr("@image html ");
-      out.addStr(link.mid(5));
+      out.addStr(link.mid(fd ? 0 : 5));
       if (!explicitTitle && !content.isEmpty())
       { 
         out.addStr(" \"");
Comment 3 Chris 2012-03-24 13:30:49 UTC
Just tried it, and I can confirm that patch does the job! Thanks.
Comment 4 Dimitri van Heesch 2012-05-19 12:26:57 UTC
This bug was previously marked ASSIGNED, which means it should be fixed in
doxygen version 1.8.1. 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.