From 5116a33d2c6d2ccac398e2f2f1f341b8cae4b847 Mon Sep 17 00:00:00 2001 From: Nikolay Vitkov <34244704+Lightning00Blade@users.noreply.github.com> Date: Mon, 15 Apr 2024 08:23:56 +0200 Subject: [PATCH] docs: remove TOC in main page (#12270) --- Herebyfile.mjs | 27 ++++++++++++++++++--------- docs/index.md | 4 ++++ 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/Herebyfile.mjs b/Herebyfile.mjs index 1b3ffb4985e..7b1e27958f3 100644 --- a/Herebyfile.mjs +++ b/Herebyfile.mjs @@ -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`. @@ -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 () => { @@ -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 [ diff --git a/docs/index.md b/docs/index.md index 6078b23c2c0..c37526c4745 100644 --- a/docs/index.md +++ b/docs/index.md @@ -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)