Skip to content

Commit

Permalink
Miscounting lines in case a fenced code block
Browse files Browse the repository at this point in the history
When having the following code:
```
# The page

~~~
ABC
  ~~~

~~~
DEF
~~~

~~~
GHI ~~~

~~~
JKL~~~

\line17
```
we get the warnings:
```
.../aa.md:16: warning: Found unknown command '\line17'
```
instead of
```
.../aa.md:17: warning: Found unknown command '\line17'
```

The last character of the fenced code block is not handled in the code block.
This problem has been solved (and also checked against the previous examples of #8045 and #8123).
  • Loading branch information
albert-github committed Dec 26, 2020
1 parent a945d52 commit 75c5c28
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/markdown.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1649,7 +1649,7 @@ static bool isFencedCodeBlock(const char *data,int size,int refIndent,
{
if (data[i]==tildaChar)
{
end=i-1;
end=i;
int endTildes=0;
while (i<size && data[i]==tildaChar) endTildes++,i++;
while (i<size && data[i]==' ') i++;
Expand Down Expand Up @@ -2291,7 +2291,6 @@ void Markdown::writeFencedCodeBlock(const char *data,const char *lng,
m_out.addStr("{"+lang+"}");
}
addStrEscapeUtf8Nbsp(data+blockStart,blockEnd-blockStart);
m_out.addStr(" ");
m_out.addStr("@endcode");
}

Expand Down

0 comments on commit 75c5c28

Please sign in to comment.