Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add toc and hide edit link #571

Merged
merged 2 commits into from
Mar 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions scripts/apidoc/apiDocsWriter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ const pathDocsApiPages = resolve(pathDocsDir, '.vitepress', 'api-pages.mjs');

const scriptCommand = 'pnpm run generate:api-docs';

// Moved here because this must not be formatted by prettier
const vitePressInFileOptions = `---
editLink: false
---

`;

const prettierMarkdown: Options = {
...prettierConfig,
parser: 'markdown',
Expand Down Expand Up @@ -59,10 +66,16 @@ export function writeApiDocsModulePage(

:::

<ul>
<li v-for="method of methods" :key="method.name">
<a :href="'#' + method.name">{{ method.title }}</a>
</li>
</ul>

<ApiDocsMethod v-for="method of methods" :key="method.name" :method="method" v-once />
`.replace(/\n +/g, '\n');

content = format(content, prettierMarkdown);
content = vitePressInFileOptions + format(content, prettierMarkdown);

writeFileSync(resolve(pathOutputDir, lowerModuleName + '.md'), content);
}
Expand All @@ -85,7 +98,7 @@ export function writeApiDocsDirectPage(methodName: string): void {
<ApiDocsMethod v-for="method of methods" :key="method.name" :method="method" v-once />
`.replace(/\n +/g, '\n');

content = format(content, prettierMarkdown);
content = vitePressInFileOptions + format(content, prettierMarkdown);

writeFileSync(resolve(pathOutputDir, methodName + '.md'), content);
}
Expand Down