Skip to content

Commit

Permalink
fix: Examples can also be terminated by the end of a file
Browse files Browse the repository at this point in the history
  • Loading branch information
TimothyJones committed Jun 1, 2024
1 parent 759b3b7 commit 853679b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/domain/exampleExtractor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@ export const extractExampleSections = (
}
}
});

// An in-progress example is also terminated by the end of the file
if (partialExample !== undefined) {
sections.push({
name: partialExample.name,
contents: partialExample.lines.join('\n'),
context,
});
}

// end-example
if (sections.length === 0) {
logger.debug(`No example sections in ${context.fullPath}`);
Expand Down

0 comments on commit 853679b

Please sign in to comment.