From 1a0a120b75c28b515cacb021d48d78c18a18b19b Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sun, 13 Oct 2013 17:31:22 +0200 Subject: Allow links to other markdown pages of the form [link text](page.md) --- doc/markdown.doc | 2 +- src/markdown.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/doc/markdown.doc b/doc/markdown.doc index 9f70a52..90caebe 100644 --- a/doc/markdown.doc +++ b/doc/markdown.doc @@ -449,7 +449,7 @@ If a page has a label you can link to it using \ref cmdref "\@ref" as is shown above. To refer to a markdown page without such label you can simple use the file name of the page, e.g. - See [the other page](@ref other.md) for more info. + See [the other page](other.md) for more info. \subsection md_html_blocks Treatment of HTML blocks diff --git a/src/markdown.cpp b/src/markdown.cpp index 19c9187..eb5a2a2 100644 --- a/src/markdown.cpp +++ b/src/markdown.cpp @@ -850,9 +850,15 @@ static int processLink(GrowBuf &out,const char *data,int,int size) } else { - if (link.find("@ref ")!=-1 || link.find("\\ref ")!=-1) + SrcLangExt lang = getLanguageFromFileName(link); + int lp=-1; + if ((lp=link.find("@ref "))!=-1 || (lp=link.find("\\ref "))!=-1 || lang==SrcLangExt_Markdown) // assume doxygen symbol link { + if (lp==-1) // link to markdown page + { + out.addStr("@ref "); + } out.addStr(link); out.addStr(" \""); if (explicitTitle && !title.isEmpty()) -- cgit v0.12