Skip to content

Commit

Permalink
When we have some simple markdown files like with extra spaces (after…
Browse files Browse the repository at this point in the history
… `\aa2`, `\bb2` and `\ccs2` to give in markdown a newline):

```
First test: 2 extra spaces after first line with error no extra empty lines
\aa2
\aa3
```
and
```
First test: 2 extra spaces after first line with error one extra empty line
\bb2

\bb4
```
and
```
First test: 2 extra spaces after first line with error two extra empty lines
\cc2

\cc5
```
we get warnings like:
```
.../aa.md:2: warning: Found unknown command '\aa2'
.../aa.md:4: warning: Found unknown command '\aa3'
.../bb.md:2: warning: Found unknown command '\bb2'
.../bb.md:5: warning: Found unknown command '\bb4'
.../cc.md:2: warning: Found unknown command '\cc2'
.../cc.md:6: warning: Found unknown command '\cc5'
```
whilst this should be:
```
.../aa.md:2: warning: Found unknown command '\aa2'
.../aa.md:3: warning: Found unknown command '\aa3'
.../bb.md:2: warning: Found unknown command '\bb2'
.../bb.md:4: warning: Found unknown command '\bb4'
.../cc.md:2: warning: Found unknown command '\cc2'
.../cc.md:5: warning: Found unknown command '\cc5'
```
This has been corrected by placing the `<br>` straight after the extra spaces and by not adding an extra newline.
  • Loading branch information
albert-github committed Oct 18, 2020
1 parent ccca51f commit f3baca7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/markdown.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2070,11 +2070,15 @@ void Markdown::writeOneLineHeaderOrRuler(const char *data,int size)
}
else // nothing interesting -> just output the line
{
m_out.addStr(data,size);
int tmpSize = size;
if (data[size-1] == '\n') tmpSize--;
m_out.addStr(data,tmpSize);

if (hasLineBreak(data,size))
{
m_out.addStr("<br>\n");
m_out.addStr("<br>");
}
if (tmpSize != size) m_out.addChar('\n');
}
}

Expand Down

0 comments on commit f3baca7

Please sign in to comment.