diff --git a/.github/workflows/build-check.yml b/.github/workflows/build-check.yml index cea8da9c74e68..69ce129ac5ba6 100644 --- a/.github/workflows/build-check.yml +++ b/.github/workflows/build-check.yml @@ -22,8 +22,8 @@ on: pull_request: concurrency: - group: ${{ github.ref }} (Build Extensions) - cancel-in-progress: false + group: build-check-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true jobs: build-and-deploy: diff --git a/src/scss/components/markdown.scss b/src/scss/components/markdown.scss index 68591fd3594bb..58efd7fe2a19f 100644 --- a/src/scss/components/markdown.scss +++ b/src/scss/components/markdown.scss @@ -257,6 +257,10 @@ } .tabs-container .tabs { position: relative; + // Isolate the active tab's z-index (999, set above so the active + // tab sits on top of .tabs::before) from the rest of the page so + // it can't climb above the sticky docs search bar. + isolation: isolate; padding-left: 0 !important; } .tabs-container .tabs::before { diff --git a/src/theme/DocItem/Layout/index.tsx b/src/theme/DocItem/Layout/index.tsx index 3564af42648df..f58dea3d67805 100644 --- a/src/theme/DocItem/Layout/index.tsx +++ b/src/theme/DocItem/Layout/index.tsx @@ -15,11 +15,17 @@ import DocItemContent from '@theme/DocItem/Content'; import DocBreadcrumbs from '@theme/DocBreadcrumbs'; import ContentVisibility from '@theme/ContentVisibility'; import type { Props } from '@theme/DocItem/Layout'; -import { generateUrl } from './pathTransfer'; import { DocsEdit } from '../../../components/Icons/docs-edit'; import styles from './styles.module.css'; +const GITHUB_TREE_BASE = 'https://github.com/apache/doris-website/tree/master/'; + +function sourceToEditUrl(source: string | undefined): string { + if (!source) return GITHUB_TREE_BASE; + return `${GITHUB_TREE_BASE}${source.replace(/^@site\//, '')}`; +} + /** * Decide if the toc should be rendered, on mobile or desktop viewports */ @@ -72,7 +78,7 @@ export default function DocItemLayout({ children }: Props): JSX.Element { {isNew ? ( <> ) : ( - + {isZH ? '编辑本页' : 'Edit this page'} )} diff --git a/src/theme/DocItem/Layout/pathTransfer.ts b/src/theme/DocItem/Layout/pathTransfer.ts deleted file mode 100644 index 277c8fe53551c..0000000000000 --- a/src/theme/DocItem/Layout/pathTransfer.ts +++ /dev/null @@ -1,71 +0,0 @@ -const transformPathWithoutZhCN = (pathname: string): string => { - if (pathname.startsWith('/docs-next/')) { - return `/docs-next${pathname.replace('/docs-next/dev', '')}.md`; - } - if(pathname.startsWith('/docs')){ - const pathWithoutDocs = pathname.replace('/docs', ''); - if(pathname.includes('/4.x')){ - return `/versioned_docs/version-4.x${pathWithoutDocs.replace('/4.x', '')}.md`; - }else if (pathname.includes('/3.x')) { - return `/versioned_docs/version-3.x${pathWithoutDocs.replace('/3.x', '')}.md`; - } else if (pathname.includes('/2.0')) { - return `/versioned_docs/version-2.0${pathWithoutDocs.replace('/2.0', '')}.md`; - } else if (pathname.includes('/1.2')) { - return `/versioned_docs/version-1.2${pathWithoutDocs.replace('/1.2', '')}.md`; - } else if (pathname.includes('/dev')) { - return `/docs${pathWithoutDocs.replace('/dev', '')}.md`; - } else { - return `/versioned_docs/version-2.1${pathWithoutDocs}.md`; - } - }else{ - // community - return `${pathname}.md` - } -}; - -const stripLocalePrefix = (pathname: string): string => { - const segments = pathname.split('/').filter(Boolean); - if (segments.length === 0) { - return pathname; - } - if (/^[a-z]{2}(?:-[A-Z]{2})?$/.test(segments[0])) { - return `/${segments.slice(1).join('/')}`; - } - return pathname; -}; - -const transformPathWithZhCN = (pathname: string): string => { - if (pathname.startsWith('/zh-CN/docs-next/')) { - return `/i18n/zh-CN/docusaurus-plugin-content-docs-next/current${pathname.replace('/zh-CN/docs-next/dev', '')}.md`; - } - if (pathname.startsWith('/zh-CN/docs')) { - if(pathname.includes('/4.x')){ - return `/i18n/zh-CN/docusaurus-plugin-content-docs/version-4.x${pathname.replace('/zh-CN/docs/4.x', '')}.md`; - }else if (pathname.includes('/3.x')) { - return `/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.x${pathname.replace('/zh-CN/docs/3.x', '')}.md`; - } else if (pathname.includes('/2.0')) { - return `/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0${pathname.replace('/zh-CN/docs/2.0', '')}.md`; - } else if (pathname.includes('/1.2')) { - return `/i18n/zh-CN/docusaurus-plugin-content-docs/version-1.2${pathname.replace('/zh-CN/docs/1.2', '')}.md`; - } else if (pathname.includes('/dev')) { - return `/i18n/zh-CN/docusaurus-plugin-content-docs/current${pathname.replace('/zh-CN/docs/dev', '')}.md`; - } else { - return `/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1${pathname.replace('/zh-CN/docs', '')}.md`;; - } - } else { - // community - return `/i18n/zh-CN/docusaurus-plugin-content-docs-community/current${pathname.replace('/zh-CN/community','')}.md` - } -} -const transformDocPath = (pathname: string): string => { - if (pathname.startsWith('/zh-CN')) { - return transformPathWithZhCN(pathname) - } else { - return transformPathWithoutZhCN(stripLocalePrefix(pathname)); - } -}; - -export const generateUrl = (pathname: string): string => { - const transformedPath = transformDocPath(pathname); - return `https://github.com/apache/doris-website/tree/master${transformedPath}`; -};