diff options
Diffstat (limited to 'src/markdown.cpp')
-rw-r--r-- | src/markdown.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/markdown.cpp b/src/markdown.cpp index 33a471a..0cf8b87 100644 --- a/src/markdown.cpp +++ b/src/markdown.cpp @@ -1693,7 +1693,12 @@ static bool isCodeBlock(const char *data,int offset,int size,int &indent) // search back 3 lines and remember the start of lines -1 and -2 while (i>0 && nl<3) { - if (data[i-offset-1]=='\n') nl_pos[nl++]=i-offset; + int j = i-offset-1; + int nl_size = isNewline(data+j); + if (nl_size>0) + { + nl_pos[nl++]=j+nl_size; + } i--; } @@ -1717,8 +1722,8 @@ static bool isCodeBlock(const char *data,int offset,int size,int &indent) // determine the indent of line -2 indent=computeIndentExcludingListMarkers(data+nl_pos[2],nl_pos[1]-nl_pos[2]); - //printf(">isCodeBlock local_indent %d>=%d+4=%d\n", - // indent0,indent2,indent0>=indent2+4); + //printf(">isCodeBlock local_indent %d>=%d+%d=%d\n", + // indent0,indent,codeBlockIndent,indent0>=indent+codeBlockIndent); // if the difference is >4 spaces -> code block return indent0>=indent+codeBlockIndent; } @@ -2152,7 +2157,7 @@ int Markdown::writeCodeBlock(const char *data,int size,int refIndent) TRACE(data); int i=0,end; //printf("writeCodeBlock: data={%s}\n",QCString(data).left(size).data()); - // no need for \ilinebr here as the prvious like was empty and was skipped + // no need for \ilinebr here as the previous line was empty and was skipped m_out.addStr("@verbatim\n"); int emptyLines=0; while (i<size) |