Skip to content

Commit

Permalink
feat: Ny linje tekst rule
Browse files Browse the repository at this point in the history
  • Loading branch information
abrhanav committed Feb 18, 2025
1 parent 59fc53a commit 19a7a45
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getText } from './utils';
export const LinebreakRule: Rule = {
name: 'Linebreak',
scope: RuleScope.INLINE,
regex: /\n|\\n/g,
regex: /\n|\\n/,
parse(match: RegexMatch): ASTNode {
return {
name: this.name,
Expand Down
4 changes: 2 additions & 2 deletions test/rules.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ describe('rules', () => {

it('should match newline followed by newline', () => {
expect(LinebreakRule.regex.exec('\n')?.index).toBe(0);
expect(LinebreakRule.regex.exec('\n\na\n\n\n')?.index).toBe(1);
expect(LinebreakRule.regex.exec('\n\n\n\n\n')?.index).toBe(2);
expect(LinebreakRule.regex.exec('\n\na\n\n\n')?.index).toBe(0);
expect(LinebreakRule.regex.exec('\n\n\n\n\n')?.index).toBe(0);
});
});

Expand Down

0 comments on commit 19a7a45

Please sign in to comment.