Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 6 additions & 0 deletions packages/core/src/utils/markdownUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ describe('markdownUtils', () => {
);
});

it('does not prefix table headers with a stray space for PascalCase keys', () => {
const data = [{ UserId: 1, Name: 'Alice' }];
const result = jsonToMarkdown(data);
expect(result).toBe('| User Id | Name |\n| --- | --- |\n| 1 | Alice |');
});

it('should handle pipe characters, backslashes, and newlines in table data', () => {
const data = [
{ colInfo: 'val|ue', otherInfo: 'line\nbreak', pathInfo: 'C:\\test' },
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/utils/markdownUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
* e.g., "camelCaseString" -> "Camel Case String"
*/
function camelToSpace(text: string): string {
const result = text.replace(/([A-Z])/g, ' $1');
return result.charAt(0).toUpperCase() + result.slice(1).trim();
const result = text.replace(/([A-Z])/g, ' $1').trim();
return result.charAt(0).toUpperCase() + result.slice(1);
}

/**
Expand Down