Skip to content

Commit 7ef29b4

Browse files
committed
Fix invalid generated link when using Markdown GitHub style link to a section in another file
1 parent 91d6d1e commit 7ef29b4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/markdown.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1527,12 +1527,12 @@ int Markdown::Private::processLink(const std::string_view data,size_t offset)
15271527
}
15281528
out+="\"";
15291529
}
1530-
else if (link.find('/')!=-1 || link.find('.')!=-1 || link.find('#')!=-1)
1530+
else if ((lp=link.find('#'))!=-1 || link.find('/')!=-1 || link.find('.')!=-1)
15311531
{ // file/url link
1532-
if (link.at(0) == '#')
1532+
if (lp!=-1 && !isURL(link))
15331533
{
15341534
out+="@ref \"";
1535-
out+=AnchorGenerator::addPrefixIfNeeded(link.mid(1).str());
1535+
out+=AnchorGenerator::addPrefixIfNeeded(link.mid(lp+1).str());
15361536
out+="\" \"";
15371537
out+=substitute(content.simplifyWhiteSpace(),"\"",""");
15381538
out+="\"";

0 commit comments

Comments
 (0)