Skip to content

Doxygen cannot resolve link to HTML anchor page #9200

@lcarlier

Description

@lcarlier

Describe the bug
Doxygen cannot resolve link to HTML anchor page in the same document.
image

Expected behavior
The link should be generated
image

Screenshots
/home/lcarlier/Projects/bugDoxygen/README.md:6: warning: unable to resolve reference to 'user-content-as' for \ref command
/home/lcarlier/Projects/bugDoxygen/README.md:6: warning: unable to resolve reference to 'user-content-as' for \ref command

To Reproduce
Untar the attached tar ball and execute doxygen using the contained doxyfile.
bugDoxygen.tar.gz

Version
This is a regression.
The patch introducing the problem is 3a4db85
The parent version is working fine.

Stack trace
NA

Additional context
I was trying to find a fix but it isn't clear to me what could be the right solution. I thought of adding the section manually via SectionManager::instance().add but the name of the output HTML isn't known inside markdown.cpp so I'm not sure whether that would be the right thing to do.

Looking at the updated documentation, it seems that some inconsistencies have been introduced.

This is the patch I was trying but it isn't working

diff --git a/src/markdown.cpp b/src/markdown.cpp
index bacefc85..f8ddeeb5 100644
--- a/src/markdown.cpp
+++ b/src/markdown.cpp
@@ -52,6 +52,7 @@
 #include "regex.h"
 #include "fileinfo.h"
 #include "utf8.h"
+#include "pagedef.h"
 
 enum class ExplicitPageResult
 {
@@ -1225,7 +1226,8 @@ int Markdown::processLink(const char *data,int,int size)
         m_out.addStr(" \"");
         m_out.addStr(substitute(content.simplifyWhiteSpace(),"\"","""));
         m_out.addStr("\"");
-
+        SectionManager::instance().add(&link.data()[1],
+                                       m_fileName,-1,title,SectionType::Anchor,0,"");
       }
       else
       {

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions