Skip to content

Commit

Permalink
[docs] Try 7
Browse files Browse the repository at this point in the history
  • Loading branch information
Marten-Mrfc committed Feb 23, 2025
1 parent 8ece1fa commit 1f4ed53
Showing 1 changed file with 36 additions and 16 deletions.
52 changes: 36 additions & 16 deletions documentation/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,26 +47,35 @@ const config: Config = {
locales: ['en'],
},

markdown: {
mermaid: true,
mdx1Compat: {
comments: false,
admonitions: false,
headingIds: false,
},
format: "detect",
parseFrontMatter: async (params) => {
const result = await params.defaultParseFrontMatter(params);
let author: AuthorData = {
...AUTHOR_FALLBACK,
};
markdown: {
mermaid: true,
mdx1Compat: {
comments: false,
admonitions: false,
headingIds: false,
},
format: "detect",
parseFrontMatter: async (params) => {
const result = await params.defaultParseFrontMatter(params);
let author: AuthorData = {
...AUTHOR_FALLBACK,
};

// Only process if this is a blog post
if (params.filePath.includes("/devlog/")) {
// Use the authors array from front matter if available
if (result.frontMatter.authors?.[0]) {
author.username = result.frontMatter.authors[0];
}

// Get git data in production
if (process.env.NODE_ENV !== "development") {
const data = await getFileCommitHashSafe(params.filePath);
if (data) {
const username = commitCache.get(data.commit);
author = {
commit: data.commit,
username: username ?? AUTHOR_FALLBACK.username,
username: username ?? author.username ?? AUTHOR_FALLBACK.username,
};
}
}
Expand All @@ -75,11 +84,14 @@ const config: Config = {
...result,
frontMatter: {
...result.frontMatter,
author: author,
authorData: author,
},
};
},
}

return result;
},
},


themes: [
Expand Down Expand Up @@ -112,6 +124,14 @@ const config: Config = {
path: './devlog',
blogSidebarCount: 'ALL',
blogSidebarTitle: 'All posts',
beforeDefaultRemarkPlugins: [],
authorsMapPath: 'authors.yml',
blogPostComponent: '@theme/BlogPostPage',
blogListComponent: '@theme/BlogListPage',
feedOptions: {
type: 'all',
copyright: `Copyright © ${new Date().getFullYear()} TypeWriter`,
},
},
],
[
Expand Down

0 comments on commit 1f4ed53

Please # to comment.