Skip to content

Commit cb7b707

Browse files
committed
issue doxygen#12155 Link names to internal anchors in a md file are duplicated in HTML page when including the md in a doxygen page
Due to doxygen#7339 the text of the linked text was double mentioned (and also a `</a>` was added that shouldn't be there, had no effect as doxygen filters it out)
1 parent a367f2b commit cb7b707

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/markdown.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,13 +1640,15 @@ int Markdown::Private::processLink(const std::string_view data,size_t offset)
16401640
}
16411641
else if ((lp=link.find('#'))!=-1 || link.find('/')!=-1 || link.find('.')!=-1)
16421642
{ // file/url link
1643+
bool isRef = false;
16431644
if (lp==0 || (lp>0 && !isURL(link) && Config_getEnum(MARKDOWN_ID_STYLE)==MARKDOWN_ID_STYLE_t::GITHUB))
16441645
{
16451646
out+="@ref \"";
16461647
out+=AnchorGenerator::addPrefixIfNeeded(link.mid(lp+1).str());
16471648
out+="\" \"";
16481649
out+=substitute(content.simplifyWhiteSpace(),"\"","&quot;");
16491650
out+="\"";
1651+
isRef = true;
16501652
}
16511653
else
16521654
{
@@ -1680,11 +1682,14 @@ int Markdown::Private::processLink(const std::string_view data,size_t offset)
16801682
foundNameRef = true;
16811683
}
16821684
}
1683-
if (!foundNameRef)
1685+
if (!isRef)
16841686
{
1685-
processInline(std::string_view(content.str()));
1687+
if (!foundNameRef)
1688+
{
1689+
processInline(std::string_view(content.str()));
1690+
}
1691+
out+="</a>";
16861692
}
1687-
out+="</a>";
16881693
}
16891694
else // avoid link to e.g. F[x](y)
16901695
{

0 commit comments

Comments
 (0)