summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlex Merry <alex.merry@kde.org>2014-03-18 14:17:17 (GMT)
committerAlex Merry <alex.merry@kde.org>2014-03-18 14:27:54 (GMT)
commite4596c7eab90ba4d307e2c212cefeab8ac820269 (patch)
tree09a0ea08d480301f93390389f5e8752b4c14a22b /src
parent683ef76f7bf1ba929f9c263064bb5f6c8e377275 (diff)
downloadDoxygen-e4596c7eab90ba4d307e2c212cefeab8ac820269.zip
Doxygen-e4596c7eab90ba4d307e2c212cefeab8ac820269.tar.gz
Doxygen-e4596c7eab90ba4d307e2c212cefeab8ac820269.tar.bz2
Implement "double-space line breaks" syntax in Markdown
Ending a line with two spaces is supposed to create a line break in Markdown. This implements that syntax.
Diffstat (limited to 'src')
-rw-r--r--src/markdown.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/markdown.cpp b/src/markdown.cpp
index 9605f31..0ab7a9c 100644
--- a/src/markdown.cpp
+++ b/src/markdown.cpp
@@ -1656,6 +1656,16 @@ static int writeTableBlock(GrowBuf &out,const char *data,int size)
}
+static int hasLineBreak(const char *data,int size)
+{
+ int i=0;
+ while (i<size && data[i]!='\n') i++;
+ if (i>=size) return 0; // empty line
+ if (i<2) return 0; // not long enough
+ return (data[i-1]==' ' && data[i-2]==' ');
+}
+
+
void writeOneLineHeaderOrRuler(GrowBuf &out,const char *data,int size)
{
int level;
@@ -1729,6 +1739,10 @@ void writeOneLineHeaderOrRuler(GrowBuf &out,const char *data,int size)
else // nothing interesting -> just output the line
{
out.addStr(data,size);
+ if (hasLineBreak(data,size))
+ {
+ out.addStr("<br>");
+ }
}
}