Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix lint
  • Loading branch information
phillipb committed Dec 31, 2021
commit d28368e0df01be09b9d49d94b835ffccc2933776
4 changes: 2 additions & 2 deletions src/Lexer.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ export class Lexer {
src = src.substring(token.raw.length);
if (token.raw.length === 1 && tokens[tokens.length - 1]) {
// if there's a single \n as a spacer, it's terminating the last line, so move it there so that we don't get unecessary paragraph tags
tokens[tokens.length - 1].raw = `${tokens[tokens.length - 1].raw}\n`
continue
tokens[tokens.length - 1].raw = `${tokens[tokens.length - 1].raw}\n`;
continue;
}
if (token.type) {
tokens.push(token);
Expand Down
6 changes: 3 additions & 3 deletions src/Tokenizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,16 +307,16 @@ export class Tokenizer {
const hasMultipleLineBreaks = spacers.every(t => {
const chars = t.raw.split('');
let lineBreaks = 0;
for (let char of chars) {
for (const char of chars) {
if (char === '\n') {
lineBreaks += 1;
}
if (lineBreaks > 1) {
return true
return true;
}
}

return false
return false;
});

if (!list.loose && spacers.length && hasMultipleLineBreaks) {
Expand Down
4 changes: 2 additions & 2 deletions test/unit/Lexer-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ lheading 2
tokens:
jasmine.arrayContaining([
jasmine.objectContaining({
raw: "T\nh\n"
raw: 'T\nh\n'
}),
{ type: 'hr', raw: '---' }
])
Expand Down Expand Up @@ -599,7 +599,7 @@ paragraph
jasmine.objectContaining({
type: 'list',
raw: '- item 2'
}),
})
])
})
]
Expand Down