Fix counting bug

This commit is contained in:
Laurenz 2021-02-04 00:38:30 +01:00
parent d86a5e8a1f
commit 8de1f8b770
2 changed files with 4 additions and 1 deletions

View File

@ -72,6 +72,8 @@ mod tests {
roundtrip("```\n line \n```");
roundtrip("```\n`\n```");
roundtrip("``` ` ```");
roundtrip("````\n```\n```\n````");
test("```lang```", "```lang ```");
test("```1 ```", "``");
test("``` 1```", "`1`");
test("``` 1 ```", "`1 `");

View File

@ -151,8 +151,9 @@ impl Pretty for NodeRaw {
// More backticks may be required if there are lots of consecutive
// backticks in the lines.
let mut count = 0;
let mut count;
for line in &self.lines {
count = 0;
for c in line.chars() {
if c == '`' {
count += 1;