Skip to content

Commit db25f4a

Browse files
committed
prettier fixes
1 parent f6d6c4f commit db25f4a

File tree

2 files changed

+60
-54
lines changed

2 files changed

+60
-54
lines changed

core/utils/markdownUtils.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,12 @@ export class MarkdownBlockStateTracker {
104104
/**
105105
* Collects all lines from a LineStream into an array for analysis.
106106
*/
107-
export async function collectAllLines<T>(stream: AsyncGenerator<T>): Promise<T[]> {
107+
export async function collectAllLines<T>(
108+
stream: AsyncGenerator<T>,
109+
): Promise<T[]> {
108110
const allLines: T[] = [];
109111
for await (const line of stream) {
110112
allLines.push(line);
111113
}
112114
return allLines;
113-
}
115+
}

core/utils/markdownUtils.vitest.ts

Lines changed: 56 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,84 @@
1-
import { test, expect } from 'vitest';
2-
import { headerIsMarkdown, isMarkdownFile, MarkdownBlockStateTracker } from './markdownUtils';
1+
import { test, expect } from "vitest";
2+
import {
3+
headerIsMarkdown,
4+
isMarkdownFile,
5+
MarkdownBlockStateTracker,
6+
} from "./markdownUtils";
37

4-
test('headerIsMarkdown correctly identifies markdown headers', () => {
8+
test("headerIsMarkdown correctly identifies markdown headers", () => {
59
// Should return true for markdown headers
6-
expect(headerIsMarkdown('md')).toBe(true);
7-
expect(headerIsMarkdown('markdown')).toBe(true);
8-
expect(headerIsMarkdown('gfm')).toBe(true);
9-
expect(headerIsMarkdown('github-markdown')).toBe(true);
10-
expect(headerIsMarkdown('language md')).toBe(true);
11-
expect(headerIsMarkdown('language markdown')).toBe(true);
12-
expect(headerIsMarkdown('filename.md')).toBe(true);
13-
expect(headerIsMarkdown('path/to/file.md language')).toBe(true);
10+
expect(headerIsMarkdown("md")).toBe(true);
11+
expect(headerIsMarkdown("markdown")).toBe(true);
12+
expect(headerIsMarkdown("gfm")).toBe(true);
13+
expect(headerIsMarkdown("github-markdown")).toBe(true);
14+
expect(headerIsMarkdown("language md")).toBe(true);
15+
expect(headerIsMarkdown("language markdown")).toBe(true);
16+
expect(headerIsMarkdown("filename.md")).toBe(true);
17+
expect(headerIsMarkdown("path/to/file.md language")).toBe(true);
1418

1519
// Should return false for non-markdown headers
16-
expect(headerIsMarkdown('javascript')).toBe(false);
17-
expect(headerIsMarkdown('typescript')).toBe(false);
18-
expect(headerIsMarkdown('python')).toBe(false);
19-
expect(headerIsMarkdown('')).toBe(false);
20+
expect(headerIsMarkdown("javascript")).toBe(false);
21+
expect(headerIsMarkdown("typescript")).toBe(false);
22+
expect(headerIsMarkdown("python")).toBe(false);
23+
expect(headerIsMarkdown("")).toBe(false);
2024
});
2125

22-
test('isMarkdownFile correctly identifies markdown files', () => {
26+
test("isMarkdownFile correctly identifies markdown files", () => {
2327
// Should return true for markdown files
24-
expect(isMarkdownFile('test.md')).toBe(true);
25-
expect(isMarkdownFile('path/to/file.markdown')).toBe(true);
26-
expect(isMarkdownFile('README.md')).toBe(true);
28+
expect(isMarkdownFile("test.md")).toBe(true);
29+
expect(isMarkdownFile("path/to/file.markdown")).toBe(true);
30+
expect(isMarkdownFile("README.md")).toBe(true);
2731

2832
// Should return false for non-markdown files
29-
expect(isMarkdownFile('test.js')).toBe(false);
30-
expect(isMarkdownFile('script.ts')).toBe(false);
31-
expect(isMarkdownFile('')).toBe(false);
33+
expect(isMarkdownFile("test.js")).toBe(false);
34+
expect(isMarkdownFile("script.ts")).toBe(false);
35+
expect(isMarkdownFile("")).toBe(false);
3236
expect(isMarkdownFile(undefined)).toBe(false);
3337
});
3438

35-
test('MarkdownBlockStateTracker correctly tracks nested markdown blocks', () => {
39+
test("MarkdownBlockStateTracker correctly tracks nested markdown blocks", () => {
3640
const lines = [
37-
'# Header',
38-
'',
39-
'Some text',
40-
'',
41-
'```md',
42-
'Nested markdown content',
43-
'```javascript',
44-
'function test() {',
45-
' return true;',
46-
'}',
47-
'```',
48-
'More nested markdown',
49-
'```',
50-
'',
51-
'End of file'
41+
"# Header",
42+
"",
43+
"Some text",
44+
"",
45+
"```md",
46+
"Nested markdown content",
47+
"```javascript",
48+
"function test() {",
49+
" return true;",
50+
"}",
51+
"```",
52+
"More nested markdown",
53+
"```",
54+
"",
55+
"End of file",
5256
];
5357

5458
const stateTracker = new MarkdownBlockStateTracker(lines);
55-
59+
5660
// First backtick closure is within nested block (not markdown end)
5761
expect(stateTracker.shouldStopAtPosition(10)).toBe(false);
58-
62+
5963
// This is the backtick that closes the outer markdown block
6064
expect(stateTracker.shouldStopAtPosition(12)).toBe(true);
6165
});
6266

63-
test('MarkdownBlockStateTracker handles simple code blocks correctly', () => {
67+
test("MarkdownBlockStateTracker handles simple code blocks correctly", () => {
6468
const lines = [
65-
'Some code:',
66-
'',
67-
'```javascript',
68-
'function test() {',
69-
' return true;',
70-
'}',
71-
'```',
72-
'',
73-
'More text'
69+
"Some code:",
70+
"",
71+
"```javascript",
72+
"function test() {",
73+
" return true;",
74+
"}",
75+
"```",
76+
"",
77+
"More text",
7478
];
7579

7680
const stateTracker = new MarkdownBlockStateTracker(lines);
77-
81+
7882
// This is just a simple code block, not nested markdown
7983
expect(stateTracker.shouldStopAtPosition(6)).toBe(false);
80-
});
84+
});

0 commit comments

Comments
 (0)