Skip to content

Commit

Permalink
fix/gh2638
Browse files Browse the repository at this point in the history
  • Loading branch information
bladerunner2020 committed Jul 13, 2024
1 parent 794d4ae commit f26d981
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/converter/comments/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ export function parseCommentString(
// Check for frontmatter
let frontmatterData: Record<string, unknown> = {};
const firstBlock = content[0];
if (firstBlock.text.startsWith("---\n")) {
if (firstBlock?.text?.startsWith("---\n")) {
const end = firstBlock.text.indexOf("\n---\n");
if (end !== -1) {
const yamlText = firstBlock.text.slice("---\n".length, end);
Expand Down
Empty file.
5 changes: 5 additions & 0 deletions src/test/converter2/issues/gh2638/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**
* @module
* @document empty.md
*/
export const a = 123;
8 changes: 8 additions & 0 deletions src/test/issues.c2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1655,4 +1655,12 @@ describe("Issue Tests", () => {
const sig = querySig(project, "B.constructor");
equal(sig.parameters?.length, 1);
});

it("#2638 empty markdown file", () => {
const project = convert();
equal(
project.documents?.map((d) => d.content),
[[]],
);
});
});

0 comments on commit f26d981

Please sign in to comment.