Skip to content

Commit

Permalink
fix(docusaurus-utils): Better fix
Browse files Browse the repository at this point in the history
  • Loading branch information
scastiel committed Jan 31, 2023
1 parent 3394bba commit ad4ed2d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/docusaurus-utils/src/markdownUtils.ts
Expand Up @@ -55,15 +55,15 @@ export function createExcerpt(fileString: string): string | undefined {
const fileLines = fileString
.trimStart()
// Remove Markdown alternate title
.replace(/^[^\n]*\n[=]+/g, '')
.split('\n');
.replace(/^[^\r\n]*\r?\n[=]+/g, '')
.split(/\r?\n/);
let inCode = false;
let inImport = false;
let lastCodeFence = '';

for (const fileLine of fileLines) {
// An empty line marks the end of imports
if (!fileLine.trim() && inImport) {
if (fileLine.trim() && inImport) {
inImport = false;
}

Expand Down

0 comments on commit ad4ed2d

Please sign in to comment.