Skip to content

Commit

Permalink
sync: Updates from docusaurus-template
Browse files Browse the repository at this point in the history
  • Loading branch information
writedocs-integration committed Jan 21, 2025
1 parent ce131dd commit fb8bce3
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions writedocs/api.merge.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ const referenceDir = path.join(__dirname, "../docs/reference");
const userPagesDir = path.join(__dirname, "../apiPages");

const extractContentAfterMetadata = (content) => {
const matches = content.match(/---\n([\s\S]*?)\n---\n([\s\S]*)/);
const matches = content.match(
/^\s*---[\r\n]+([\s\S]*?)[\r\n]+\s*---[\r\n]+([\s\S]*)/
);
let processedContent = matches ? matches[2].trim() : content;

// Remove import statements
Expand All @@ -27,11 +29,11 @@ const processDirectory = (dirPath, isApiPagesDir = true) => {
const correspondingRefPath = path.join(referenceDir, relativePath);
processDirectory(fullPath, isApiPagesDir);
} else if (
item.endsWith(".mdx") &&
item.endsWith(".endpoint.mdx") &&
!item.endsWith(".api.mdx") &&
!item.endsWith("info.mdx")
) {
const baseName = item.slice(0, -4);
const baseName = item.slice(0, -13);
// Calculate the path for the .api.mdx file in the reference directory
const relativePath = path.relative(userPagesDir, dirPath);
const correspondingRefPath = path.join(referenceDir, relativePath);
Expand Down Expand Up @@ -77,7 +79,8 @@ const processDirectory = (dirPath, isApiPagesDir = true) => {
});
} catch (error) {
// console.error(`Error processing directory ${dirPath}: ${error.message}`);
process.exit(1);
// process.exit(1);
return;
}
};

Expand Down

0 comments on commit fb8bce3

Please sign in to comment.