GNOME Bugzilla – Bug 672656
Images not copied when using ![caption](filename) image syntax in markdown files
Last modified: 2012-05-19 12:26:57 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"/> ---------
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.
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(" \"");
Just tried it, and I can confirm that patch does the job! Thanks.
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.