From 6b74af9867b025dc7c031f4cb518c8d017f7d6c8 Mon Sep 17 00:00:00 2001 From: sebastien Date: Tue, 6 May 2025 10:48:03 +0200 Subject: [PATCH 1/3] restore former internal APIs --- packages/docusaurus-theme-common/src/internal.ts | 7 +++++++ .../docusaurus-theme-common/src/utils/codeBlockUtils.tsx | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/packages/docusaurus-theme-common/src/internal.ts b/packages/docusaurus-theme-common/src/internal.ts index b1c116a0c6ea..fb6b3ace7221 100644 --- a/packages/docusaurus-theme-common/src/internal.ts +++ b/packages/docusaurus-theme-common/src/internal.ts @@ -39,6 +39,13 @@ export { getPrismCssVariables, CodeBlockContextProvider, useCodeBlockContext, + + // TODO Docusaurus v4: remove, only kept for internal retro-compatibility + parseCodeBlockTitle, + parseClassNameLanguage as parseLanguage, + parseLines, + getLineNumbersStart, + containsLineNumbers, } from './utils/codeBlockUtils'; export {DEFAULT_SEARCH_TAG} from './utils/searchUtils'; diff --git a/packages/docusaurus-theme-common/src/utils/codeBlockUtils.tsx b/packages/docusaurus-theme-common/src/utils/codeBlockUtils.tsx index 914fc5de3557..4b740699b445 100644 --- a/packages/docusaurus-theme-common/src/utils/codeBlockUtils.tsx +++ b/packages/docusaurus-theme-common/src/utils/codeBlockUtils.tsx @@ -188,6 +188,11 @@ export function getLineNumbersStart({ return getMetaLineNumbersStart(metastring); } +// TODO Docusaurus v4: remove, only kept for internal retro-compatibility +export function containsLineNumbers(metastring?: string): boolean { + return Boolean(metastring?.includes('showLineNumbers')); +} + type ParseCodeLinesParam = { /** * The full metastring, as received from MDX. Line ranges declared here From 6ad218bcc02e0e626d2f9cfd2e1bb5022c4f135d Mon Sep 17 00:00:00 2001 From: sebastien Date: Tue, 6 May 2025 10:54:21 +0200 Subject: [PATCH 2/3] restore former internal APIs --- packages/docusaurus-theme-common/src/internal.ts | 1 + packages/docusaurus-theme-common/src/utils/codeBlockUtils.tsx | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/docusaurus-theme-common/src/internal.ts b/packages/docusaurus-theme-common/src/internal.ts index fb6b3ace7221..d8d5821c95f8 100644 --- a/packages/docusaurus-theme-common/src/internal.ts +++ b/packages/docusaurus-theme-common/src/internal.ts @@ -41,6 +41,7 @@ export { useCodeBlockContext, // TODO Docusaurus v4: remove, only kept for internal retro-compatibility + // See https://github.com/facebook/docusaurus/pull/11153 parseCodeBlockTitle, parseClassNameLanguage as parseLanguage, parseLines, diff --git a/packages/docusaurus-theme-common/src/utils/codeBlockUtils.tsx b/packages/docusaurus-theme-common/src/utils/codeBlockUtils.tsx index 4b740699b445..fc18e4d44b57 100644 --- a/packages/docusaurus-theme-common/src/utils/codeBlockUtils.tsx +++ b/packages/docusaurus-theme-common/src/utils/codeBlockUtils.tsx @@ -189,6 +189,7 @@ export function getLineNumbersStart({ } // TODO Docusaurus v4: remove, only kept for internal retro-compatibility +// See https://github.com/facebook/docusaurus/pull/11153 export function containsLineNumbers(metastring?: string): boolean { return Boolean(metastring?.includes('showLineNumbers')); } From 3c6bea81fab936001c1dc0c2b5971fb11b4bbe07 Mon Sep 17 00:00:00 2001 From: slorber <749374+slorber@users.noreply.github.com> Date: Tue, 6 May 2025 08:59:24 +0000 Subject: [PATCH 3/3] refactor: apply lint autofix --- website/docs/deployment.mdx | 60 +++++++++---------------------------- 1 file changed, 14 insertions(+), 46 deletions(-) diff --git a/website/docs/deployment.mdx b/website/docs/deployment.mdx index 24460c4b9e7e..34a5ab823d9e 100644 --- a/website/docs/deployment.mdx +++ b/website/docs/deployment.mdx @@ -383,25 +383,9 @@ If your Docusaurus project is not at the root of your repo, you may need to conf ```yml title=".github/workflows/deploy.yml" name: Deploy to GitHub Pages -on: - push: - branches: - - main - # Review gh actions docs if you want to further define triggers, paths, etc - # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on +on: push: branches: - main # Review gh actions docs if you want to further define triggers, paths, etc # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on -jobs: - build: - name: Build Docusaurus - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: npm +jobs: build: name: Build Docusaurus runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: actions/setup-node@v4 with: node-version: 18 cache: npm - name: Install dependencies run: npm ci @@ -413,9 +397,7 @@ jobs: with: path: build - deploy: - name: Deploy to GitHub Pages - needs: build +deploy: name: Deploy to GitHub Pages needs: build # Grant GITHUB_TOKEN the permissions required to make a Pages deployment permissions: @@ -432,7 +414,8 @@ jobs: - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4 -``` + +```` ```yml title=".github/workflows/test-deploy.yml" name: Test deployment @@ -461,31 +444,16 @@ jobs: run: npm ci - name: Test build website run: npm build -``` +```` + ```yml title=".github/workflows/deploy.yml" name: Deploy to GitHub Pages -on: - push: - branches: - - main - # Review gh actions docs if you want to further define triggers, paths, etc - # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on +on: push: branches: - main # Review gh actions docs if you want to further define triggers, paths, etc # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on -jobs: - build: - name: Build Docusaurus - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: yarn +jobs: build: name: Build Docusaurus runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: actions/setup-node@v4 with: node-version: 18 cache: yarn - name: Install dependencies run: yarn install --frozen-lockfile @@ -497,9 +465,7 @@ jobs: with: path: build - deploy: - name: Deploy to GitHub Pages - needs: build +deploy: name: Deploy to GitHub Pages needs: build # Grant GITHUB_TOKEN the permissions required to make a Pages deployment permissions: @@ -516,7 +482,8 @@ jobs: - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4 -``` + +```` ```yml title=".github/workflows/test-deploy.yml" name: Test deployment @@ -545,7 +512,8 @@ jobs: run: yarn install --frozen-lockfile - name: Test build website run: yarn build -``` +```` +