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: remove TOC in main page #12270

Merged
merged 2 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 18 additions & 9 deletions Herebyfile.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@

/* eslint-disable import/order */

import {copyFile, readFile, writeFile} from 'fs/promises';
import {readFile, writeFile} from 'fs/promises';

import {docgen, spliceIntoSection} from '@puppeteer/docgen';
import {execa} from 'execa';
import {task} from 'hereby';
import semver from 'semver';

export const docsNgSchematicsTask = task({
name: 'docs:ng-schematics',
run: async () => {
const readme = await readFile('packages/ng-schematics/README.md', 'utf-8');
await writeFile('docs/guides/ng-schematics.md', readme);
},
});
function addNoTocHeader(markdown) {
return `---
hide_table_of_contents: true
---

${markdown}`;
}

/**
* This logic should match the one in `website/docusaurus.config.js`.
Expand All @@ -34,6 +34,14 @@ function getApiUrl(version) {
}
}

export const docsNgSchematicsTask = task({
name: 'docs:ng-schematics',
run: async () => {
const readme = await readFile('packages/ng-schematics/README.md', 'utf-8');
await writeFile('docs/guides/ng-schematics.md', readme);
},
});

export const docsChromiumSupportTask = task({
name: 'docs:supported-browsers',
run: async () => {
Expand Down Expand Up @@ -72,7 +80,8 @@ export const docsTask = task({
dependencies: [docsNgSchematicsTask, docsChromiumSupportTask],
run: async () => {
// Copy main page.
await copyFile('README.md', 'docs/index.md');
const mainPage = await readFile('README.md', 'utf-8');
await writeFile('docs/index.md', addNoTocHeader(mainPage));

// Generate documentation
for (const [name, folder] of [
Expand Down
4 changes: 4 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
hide_table_of_contents: true
---

# Puppeteer

[![build](https://github.com/puppeteer/puppeteer/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/puppeteer/puppeteer/actions/workflows/ci.yml)
Expand Down