@docusaurus/theme-classic 0.0.0-5136 → 0.0.0-5142
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/theme/{DocItemFooter → DocItem/Content}/index.d.ts +2 -3
- package/lib/theme/DocItem/Content/index.js +43 -0
- package/lib/theme/DocItem/Footer/index.d.ts +8 -0
- package/lib/theme/{DocItemFooter → DocItem/Footer}/index.js +3 -4
- package/lib/theme/{DocItemFooter → DocItem/Footer}/styles.module.css +0 -0
- package/lib/theme/DocItem/Layout/index.d.ts +9 -0
- package/lib/theme/DocItem/Layout/index.js +58 -0
- package/lib/theme/DocItem/Layout/styles.module.css +17 -0
- package/lib/theme/DocItem/Metadata/index.d.ts +8 -0
- package/lib/theme/DocItem/Metadata/index.js +19 -0
- package/lib/theme/DocItem/Paginator/index.d.ts +12 -0
- package/lib/theme/DocItem/Paginator/index.js +17 -0
- package/lib/theme/DocItem/TOC/Desktop/index.d.ts +8 -0
- package/lib/theme/DocItem/TOC/Desktop/index.js +20 -0
- package/lib/theme/DocItem/TOC/Mobile/index.d.ts +8 -0
- package/lib/theme/DocItem/TOC/Mobile/index.js +22 -0
- package/lib/theme/DocItem/{styles.module.css → TOC/Mobile/styles.module.css} +0 -9
- package/lib/theme/DocItem/index.js +12 -105
- package/package.json +14 -14
- package/src/theme/DocItem/Content/index.tsx +47 -0
- package/src/theme/{DocItemFooter → DocItem/Footer}/index.tsx +8 -6
- package/src/theme/{DocItemFooter → DocItem/Footer}/styles.module.css +0 -0
- package/src/theme/DocItem/Layout/index.tsx +67 -0
- package/src/theme/DocItem/Layout/styles.module.css +17 -0
- package/src/theme/DocItem/Metadata/index.tsx +21 -0
- package/src/theme/DocItem/Paginator/index.tsx +19 -0
- package/src/theme/DocItem/TOC/Desktop/index.tsx +23 -0
- package/src/theme/DocItem/TOC/Mobile/index.tsx +25 -0
- package/src/theme/DocItem/{styles.module.css → TOC/Mobile/styles.module.css} +0 -9
- package/src/theme/DocItem/index.tsx +12 -114
- package/src/theme/DocPaginator/index.tsx +0 -1
- package/src/theme-classic.d.ts +33 -3
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
/// <reference types="@docusaurus/plugin-content-docs" />
|
|
8
7
|
/// <reference types="react" />
|
|
9
|
-
import type { Props } from '@theme/DocItem';
|
|
10
|
-
export default function
|
|
8
|
+
import type { Props } from '@theme/DocItem/Content';
|
|
9
|
+
export default function DocItemContent({ children }: Props): JSX.Element;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import clsx from 'clsx';
|
|
9
|
+
import {ThemeClassNames, useDoc} from '@docusaurus/theme-common';
|
|
10
|
+
import Heading from '@theme/Heading';
|
|
11
|
+
import MDXContent from '@theme/MDXContent';
|
|
12
|
+
/**
|
|
13
|
+
Title can be declared inside md content or declared through
|
|
14
|
+
front matter and added manually. To make both cases consistent,
|
|
15
|
+
the added title is added under the same div.markdown block
|
|
16
|
+
See https://github.com/facebook/docusaurus/pull/4882#issuecomment-853021120
|
|
17
|
+
|
|
18
|
+
We render a "synthetic title" if:
|
|
19
|
+
- user doesn't ask to hide it with front matter
|
|
20
|
+
- the markdown content does not already contain a top-level h1 heading
|
|
21
|
+
*/
|
|
22
|
+
function useSyntheticTitle() {
|
|
23
|
+
const {metadata, frontMatter, contentTitle} = useDoc();
|
|
24
|
+
const shouldRender =
|
|
25
|
+
!frontMatter.hide_title && typeof contentTitle === 'undefined';
|
|
26
|
+
if (!shouldRender) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
return metadata.title;
|
|
30
|
+
}
|
|
31
|
+
export default function DocItemContent({children}) {
|
|
32
|
+
const syntheticTitle = useSyntheticTitle();
|
|
33
|
+
return (
|
|
34
|
+
<div className={clsx(ThemeClassNames.docs.docMarkdown, 'markdown')}>
|
|
35
|
+
{syntheticTitle && (
|
|
36
|
+
<header>
|
|
37
|
+
<Heading as="h1">{syntheticTitle}</Heading>
|
|
38
|
+
</header>
|
|
39
|
+
)}
|
|
40
|
+
<MDXContent>{children}</MDXContent>
|
|
41
|
+
</div>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
/// <reference types="react" />
|
|
8
|
+
export default function DocItemFooter(): JSX.Element | null;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
|
-
import {ThemeClassNames} from '@docusaurus/theme-common';
|
|
9
|
+
import {ThemeClassNames, useDoc} from '@docusaurus/theme-common';
|
|
10
10
|
import LastUpdated from '@theme/LastUpdated';
|
|
11
11
|
import EditThisPage from '@theme/EditThisPage';
|
|
12
12
|
import TagsListInline from '@theme/TagsListInline';
|
|
@@ -46,9 +46,8 @@ function EditMetaRow({
|
|
|
46
46
|
</div>
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
|
-
export default function DocItemFooter(
|
|
50
|
-
const {
|
|
51
|
-
const {metadata} = DocContent;
|
|
49
|
+
export default function DocItemFooter() {
|
|
50
|
+
const {metadata} = useDoc();
|
|
52
51
|
const {editUrl, lastUpdatedAt, formattedLastUpdatedAt, lastUpdatedBy, tags} =
|
|
53
52
|
metadata;
|
|
54
53
|
const canDisplayTagsRow = tags.length > 0;
|
|
File without changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
/// <reference types="react" />
|
|
8
|
+
import type { Props } from '@theme/DocItem/Layout';
|
|
9
|
+
export default function DocItemLayout({ children }: Props): JSX.Element;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import clsx from 'clsx';
|
|
9
|
+
import {useWindowSize, useDoc} from '@docusaurus/theme-common';
|
|
10
|
+
import DocItemPaginator from '@theme/DocItem/Paginator';
|
|
11
|
+
import DocVersionBanner from '@theme/DocVersionBanner';
|
|
12
|
+
import DocVersionBadge from '@theme/DocVersionBadge';
|
|
13
|
+
import DocItemFooter from '@theme/DocItem/Footer';
|
|
14
|
+
import DocItemTOCMobile from '@theme/DocItem/TOC/Mobile';
|
|
15
|
+
import DocItemTOCDesktop from '@theme/DocItem/TOC/Desktop';
|
|
16
|
+
import DocItemContent from '@theme/DocItem/Content';
|
|
17
|
+
import DocBreadcrumbs from '@theme/DocBreadcrumbs';
|
|
18
|
+
import styles from './styles.module.css';
|
|
19
|
+
/**
|
|
20
|
+
* Decide if the toc should be rendered, on mobile or desktop viewports
|
|
21
|
+
*/
|
|
22
|
+
function useDocTOC() {
|
|
23
|
+
const {frontMatter, toc} = useDoc();
|
|
24
|
+
const windowSize = useWindowSize();
|
|
25
|
+
const hidden = frontMatter.hide_table_of_contents;
|
|
26
|
+
const canRender = !hidden && toc.length > 0;
|
|
27
|
+
const mobile = canRender ? <DocItemTOCMobile /> : undefined;
|
|
28
|
+
const desktop =
|
|
29
|
+
canRender && (windowSize === 'desktop' || windowSize === 'ssr') ? (
|
|
30
|
+
<DocItemTOCDesktop />
|
|
31
|
+
) : undefined;
|
|
32
|
+
return {
|
|
33
|
+
hidden,
|
|
34
|
+
mobile,
|
|
35
|
+
desktop,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export default function DocItemLayout({children}) {
|
|
39
|
+
const docTOC = useDocTOC();
|
|
40
|
+
return (
|
|
41
|
+
<div className="row">
|
|
42
|
+
<div className={clsx('col', !docTOC.hidden && styles.docItemCol)}>
|
|
43
|
+
<DocVersionBanner />
|
|
44
|
+
<div className={styles.docItemContainer}>
|
|
45
|
+
<article>
|
|
46
|
+
<DocBreadcrumbs />
|
|
47
|
+
<DocVersionBadge />
|
|
48
|
+
{docTOC.mobile}
|
|
49
|
+
<DocItemContent>{children}</DocItemContent>
|
|
50
|
+
<DocItemFooter />
|
|
51
|
+
</article>
|
|
52
|
+
<DocItemPaginator />
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
{docTOC.desktop && <div className="col col--3">{docTOC.desktop}</div>}
|
|
56
|
+
</div>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
.docItemContainer header + *,
|
|
9
|
+
.docItemContainer article > *:first-child {
|
|
10
|
+
margin-top: 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@media (min-width: 997px) {
|
|
14
|
+
.docItemCol {
|
|
15
|
+
max-width: 75% !important;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
/// <reference types="react" />
|
|
8
|
+
export default function DocItemMetadata(): JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import {PageMetadata, useDoc} from '@docusaurus/theme-common';
|
|
9
|
+
export default function DocItemMetadata() {
|
|
10
|
+
const {metadata, frontMatter, assets} = useDoc();
|
|
11
|
+
return (
|
|
12
|
+
<PageMetadata
|
|
13
|
+
title={metadata.title}
|
|
14
|
+
description={metadata.description}
|
|
15
|
+
keywords={frontMatter.keywords}
|
|
16
|
+
image={assets.image ?? frontMatter.image}
|
|
17
|
+
/>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
/// <reference types="react" />
|
|
8
|
+
/**
|
|
9
|
+
* This extra component is needed, because <DocPaginator> should remain generic.
|
|
10
|
+
* DocPaginator is used in non-docs contexts too: generated-index pages...
|
|
11
|
+
*/
|
|
12
|
+
export default function DocItemPaginator(): JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import {useDoc} from '@docusaurus/theme-common';
|
|
9
|
+
import DocPaginator from '@theme/DocPaginator';
|
|
10
|
+
/**
|
|
11
|
+
* This extra component is needed, because <DocPaginator> should remain generic.
|
|
12
|
+
* DocPaginator is used in non-docs contexts too: generated-index pages...
|
|
13
|
+
*/
|
|
14
|
+
export default function DocItemPaginator() {
|
|
15
|
+
const {metadata} = useDoc();
|
|
16
|
+
return <DocPaginator previous={metadata.previous} next={metadata.next} />;
|
|
17
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
/// <reference types="react" />
|
|
8
|
+
export default function DocItemTOCDesktop(): JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import {ThemeClassNames, useDoc} from '@docusaurus/theme-common';
|
|
9
|
+
import TOC from '@theme/TOC';
|
|
10
|
+
export default function DocItemTOCDesktop() {
|
|
11
|
+
const {toc, frontMatter} = useDoc();
|
|
12
|
+
return (
|
|
13
|
+
<TOC
|
|
14
|
+
toc={toc}
|
|
15
|
+
minHeadingLevel={frontMatter.toc_min_heading_level}
|
|
16
|
+
maxHeadingLevel={frontMatter.toc_max_heading_level}
|
|
17
|
+
className={ThemeClassNames.docs.docTocDesktop}
|
|
18
|
+
/>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
/// <reference types="react" />
|
|
8
|
+
export default function DocItemTOCMobile(): JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import clsx from 'clsx';
|
|
9
|
+
import {ThemeClassNames, useDoc} from '@docusaurus/theme-common';
|
|
10
|
+
import TOCCollapsible from '@theme/TOCCollapsible';
|
|
11
|
+
import styles from './styles.module.css';
|
|
12
|
+
export default function DocItemTOCMobile() {
|
|
13
|
+
const {toc, frontMatter} = useDoc();
|
|
14
|
+
return (
|
|
15
|
+
<TOCCollapsible
|
|
16
|
+
toc={toc}
|
|
17
|
+
minHeadingLevel={frontMatter.toc_min_heading_level}
|
|
18
|
+
maxHeadingLevel={frontMatter.toc_max_heading_level}
|
|
19
|
+
className={clsx(ThemeClassNames.docs.docTocMobile, styles.tocMobile)}
|
|
20
|
+
/>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
@@ -5,16 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
.docItemContainer header + *,
|
|
9
|
-
.docItemContainer article > *:first-child {
|
|
10
|
-
margin-top: 0;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
8
|
@media (min-width: 997px) {
|
|
14
|
-
.docItemCol {
|
|
15
|
-
max-width: 75% !important;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
9
|
/* Prevent hydration FOUC, as the mobile TOC needs to be server-rendered */
|
|
19
10
|
.tocMobile {
|
|
20
11
|
display: none;
|
|
@@ -5,113 +5,20 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
HtmlClassNameProvider,
|
|
12
|
-
ThemeClassNames,
|
|
13
|
-
useWindowSize,
|
|
14
|
-
} from '@docusaurus/theme-common';
|
|
15
|
-
import DocPaginator from '@theme/DocPaginator';
|
|
16
|
-
import DocVersionBanner from '@theme/DocVersionBanner';
|
|
17
|
-
import DocVersionBadge from '@theme/DocVersionBadge';
|
|
18
|
-
import DocItemFooter from '@theme/DocItemFooter';
|
|
19
|
-
import TOC from '@theme/TOC';
|
|
20
|
-
import TOCCollapsible from '@theme/TOCCollapsible';
|
|
21
|
-
import Heading from '@theme/Heading';
|
|
22
|
-
import DocBreadcrumbs from '@theme/DocBreadcrumbs';
|
|
23
|
-
import MDXContent from '@theme/MDXContent';
|
|
24
|
-
import styles from './styles.module.css';
|
|
25
|
-
function DocItemMetadata(props) {
|
|
26
|
-
const {content: DocContent} = props;
|
|
27
|
-
const {metadata, frontMatter, assets} = DocContent;
|
|
28
|
-
const {keywords} = frontMatter;
|
|
29
|
-
const {description, title} = metadata;
|
|
30
|
-
const image = assets.image ?? frontMatter.image;
|
|
31
|
-
return <PageMetadata {...{title, description, keywords, image}} />;
|
|
32
|
-
}
|
|
33
|
-
function DocItemContent(props) {
|
|
34
|
-
const {content: DocContent} = props;
|
|
35
|
-
const {metadata, frontMatter} = DocContent;
|
|
36
|
-
const {
|
|
37
|
-
hide_title: hideTitle,
|
|
38
|
-
hide_table_of_contents: hideTableOfContents,
|
|
39
|
-
toc_min_heading_level: tocMinHeadingLevel,
|
|
40
|
-
toc_max_heading_level: tocMaxHeadingLevel,
|
|
41
|
-
} = frontMatter;
|
|
42
|
-
const {title} = metadata;
|
|
43
|
-
// We only add a title if:
|
|
44
|
-
// - user doesn't ask to hide it with front matter
|
|
45
|
-
// - the markdown content does not already contain a top-level h1 heading
|
|
46
|
-
const shouldAddTitle =
|
|
47
|
-
!hideTitle && typeof DocContent.contentTitle === 'undefined';
|
|
48
|
-
const windowSize = useWindowSize();
|
|
49
|
-
const canRenderTOC = !hideTableOfContents && DocContent.toc.length > 0;
|
|
50
|
-
const renderTocDesktop =
|
|
51
|
-
canRenderTOC && (windowSize === 'desktop' || windowSize === 'ssr');
|
|
52
|
-
return (
|
|
53
|
-
<div className="row">
|
|
54
|
-
<div className={clsx('col', !hideTableOfContents && styles.docItemCol)}>
|
|
55
|
-
<DocVersionBanner />
|
|
56
|
-
<div className={styles.docItemContainer}>
|
|
57
|
-
<article>
|
|
58
|
-
<DocBreadcrumbs />
|
|
59
|
-
<DocVersionBadge />
|
|
60
|
-
|
|
61
|
-
{canRenderTOC && (
|
|
62
|
-
<TOCCollapsible
|
|
63
|
-
toc={DocContent.toc}
|
|
64
|
-
minHeadingLevel={tocMinHeadingLevel}
|
|
65
|
-
maxHeadingLevel={tocMaxHeadingLevel}
|
|
66
|
-
className={clsx(
|
|
67
|
-
ThemeClassNames.docs.docTocMobile,
|
|
68
|
-
styles.tocMobile,
|
|
69
|
-
)}
|
|
70
|
-
/>
|
|
71
|
-
)}
|
|
72
|
-
|
|
73
|
-
<div className={clsx(ThemeClassNames.docs.docMarkdown, 'markdown')}>
|
|
74
|
-
{/*
|
|
75
|
-
Title can be declared inside md content or declared through
|
|
76
|
-
front matter and added manually. To make both cases consistent,
|
|
77
|
-
the added title is added under the same div.markdown block
|
|
78
|
-
See https://github.com/facebook/docusaurus/pull/4882#issuecomment-853021120
|
|
79
|
-
*/}
|
|
80
|
-
{shouldAddTitle && (
|
|
81
|
-
<header>
|
|
82
|
-
<Heading as="h1">{title}</Heading>
|
|
83
|
-
</header>
|
|
84
|
-
)}
|
|
85
|
-
<MDXContent>
|
|
86
|
-
<DocContent />
|
|
87
|
-
</MDXContent>
|
|
88
|
-
</div>
|
|
89
|
-
|
|
90
|
-
<DocItemFooter {...props} />
|
|
91
|
-
</article>
|
|
92
|
-
|
|
93
|
-
<DocPaginator previous={metadata.previous} next={metadata.next} />
|
|
94
|
-
</div>
|
|
95
|
-
</div>
|
|
96
|
-
{renderTocDesktop && (
|
|
97
|
-
<div className="col col--3">
|
|
98
|
-
<TOC
|
|
99
|
-
toc={DocContent.toc}
|
|
100
|
-
minHeadingLevel={tocMinHeadingLevel}
|
|
101
|
-
maxHeadingLevel={tocMaxHeadingLevel}
|
|
102
|
-
className={ThemeClassNames.docs.docTocDesktop}
|
|
103
|
-
/>
|
|
104
|
-
</div>
|
|
105
|
-
)}
|
|
106
|
-
</div>
|
|
107
|
-
);
|
|
108
|
-
}
|
|
8
|
+
import {HtmlClassNameProvider, DocProvider} from '@docusaurus/theme-common';
|
|
9
|
+
import DocItemMetadata from '@theme/DocItem/Metadata';
|
|
10
|
+
import DocItemLayout from '@theme/DocItem/Layout';
|
|
109
11
|
export default function DocItem(props) {
|
|
110
12
|
const docHtmlClassName = `docs-doc-id-${props.content.metadata.unversionedId}`;
|
|
13
|
+
const MDXComponent = props.content;
|
|
111
14
|
return (
|
|
112
|
-
<
|
|
113
|
-
<
|
|
114
|
-
|
|
115
|
-
|
|
15
|
+
<DocProvider content={props.content}>
|
|
16
|
+
<HtmlClassNameProvider className={docHtmlClassName}>
|
|
17
|
+
<DocItemMetadata />
|
|
18
|
+
<DocItemLayout>
|
|
19
|
+
<MDXComponent />
|
|
20
|
+
</DocItemLayout>
|
|
21
|
+
</HtmlClassNameProvider>
|
|
22
|
+
</DocProvider>
|
|
116
23
|
);
|
|
117
24
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/theme-classic",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-5142",
|
|
4
4
|
"description": "Classic theme for Docusaurus",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/theme-classic.d.ts",
|
|
@@ -20,18 +20,18 @@
|
|
|
20
20
|
"copy:watch": "node ../../admin/scripts/copyUntypedFiles.js --watch"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@docusaurus/core": "0.0.0-
|
|
24
|
-
"@docusaurus/mdx-loader": "0.0.0-
|
|
25
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
26
|
-
"@docusaurus/plugin-content-blog": "0.0.0-
|
|
27
|
-
"@docusaurus/plugin-content-docs": "0.0.0-
|
|
28
|
-
"@docusaurus/plugin-content-pages": "0.0.0-
|
|
29
|
-
"@docusaurus/theme-common": "0.0.0-
|
|
30
|
-
"@docusaurus/theme-translations": "0.0.0-
|
|
31
|
-
"@docusaurus/types": "0.0.0-
|
|
32
|
-
"@docusaurus/utils": "0.0.0-
|
|
33
|
-
"@docusaurus/utils-common": "0.0.0-
|
|
34
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
23
|
+
"@docusaurus/core": "0.0.0-5142",
|
|
24
|
+
"@docusaurus/mdx-loader": "0.0.0-5142",
|
|
25
|
+
"@docusaurus/module-type-aliases": "0.0.0-5142",
|
|
26
|
+
"@docusaurus/plugin-content-blog": "0.0.0-5142",
|
|
27
|
+
"@docusaurus/plugin-content-docs": "0.0.0-5142",
|
|
28
|
+
"@docusaurus/plugin-content-pages": "0.0.0-5142",
|
|
29
|
+
"@docusaurus/theme-common": "0.0.0-5142",
|
|
30
|
+
"@docusaurus/theme-translations": "0.0.0-5142",
|
|
31
|
+
"@docusaurus/types": "0.0.0-5142",
|
|
32
|
+
"@docusaurus/utils": "0.0.0-5142",
|
|
33
|
+
"@docusaurus/utils-common": "0.0.0-5142",
|
|
34
|
+
"@docusaurus/utils-validation": "0.0.0-5142",
|
|
35
35
|
"@mdx-js/react": "^1.6.22",
|
|
36
36
|
"clsx": "^1.1.1",
|
|
37
37
|
"copy-text-to-clipboard": "^3.0.1",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"engines": {
|
|
65
65
|
"node": ">=16.14"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "e791a64c45af1206bea392117ff42413f85d7bdb"
|
|
68
68
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import clsx from 'clsx';
|
|
10
|
+
import {ThemeClassNames, useDoc} from '@docusaurus/theme-common';
|
|
11
|
+
import Heading from '@theme/Heading';
|
|
12
|
+
import MDXContent from '@theme/MDXContent';
|
|
13
|
+
import type {Props} from '@theme/DocItem/Content';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
Title can be declared inside md content or declared through
|
|
17
|
+
front matter and added manually. To make both cases consistent,
|
|
18
|
+
the added title is added under the same div.markdown block
|
|
19
|
+
See https://github.com/facebook/docusaurus/pull/4882#issuecomment-853021120
|
|
20
|
+
|
|
21
|
+
We render a "synthetic title" if:
|
|
22
|
+
- user doesn't ask to hide it with front matter
|
|
23
|
+
- the markdown content does not already contain a top-level h1 heading
|
|
24
|
+
*/
|
|
25
|
+
function useSyntheticTitle(): string | null {
|
|
26
|
+
const {metadata, frontMatter, contentTitle} = useDoc();
|
|
27
|
+
const shouldRender =
|
|
28
|
+
!frontMatter.hide_title && typeof contentTitle === 'undefined';
|
|
29
|
+
if (!shouldRender) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
return metadata.title;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default function DocItemContent({children}: Props): JSX.Element {
|
|
36
|
+
const syntheticTitle = useSyntheticTitle();
|
|
37
|
+
return (
|
|
38
|
+
<div className={clsx(ThemeClassNames.docs.docMarkdown, 'markdown')}>
|
|
39
|
+
{syntheticTitle && (
|
|
40
|
+
<header>
|
|
41
|
+
<Heading as="h1">{syntheticTitle}</Heading>
|
|
42
|
+
</header>
|
|
43
|
+
)}
|
|
44
|
+
<MDXContent>{children}</MDXContent>
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
@@ -7,13 +7,16 @@
|
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import clsx from 'clsx';
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
ThemeClassNames,
|
|
12
|
+
useDoc,
|
|
13
|
+
type DocContextValue,
|
|
14
|
+
} from '@docusaurus/theme-common';
|
|
11
15
|
import LastUpdated from '@theme/LastUpdated';
|
|
12
16
|
import EditThisPage from '@theme/EditThisPage';
|
|
13
17
|
import TagsListInline, {
|
|
14
18
|
type Props as TagsListInlineProps,
|
|
15
19
|
} from '@theme/TagsListInline';
|
|
16
|
-
import type {Props} from '@theme/DocItem';
|
|
17
20
|
|
|
18
21
|
import styles from './styles.module.css';
|
|
19
22
|
|
|
@@ -32,7 +35,7 @@ function TagsRow(props: TagsListInlineProps) {
|
|
|
32
35
|
}
|
|
33
36
|
|
|
34
37
|
type EditMetaRowProps = Pick<
|
|
35
|
-
|
|
38
|
+
DocContextValue['metadata'],
|
|
36
39
|
'editUrl' | 'lastUpdatedAt' | 'lastUpdatedBy' | 'formattedLastUpdatedAt'
|
|
37
40
|
>;
|
|
38
41
|
function EditMetaRow({
|
|
@@ -58,9 +61,8 @@ function EditMetaRow({
|
|
|
58
61
|
);
|
|
59
62
|
}
|
|
60
63
|
|
|
61
|
-
export default function DocItemFooter(
|
|
62
|
-
const {
|
|
63
|
-
const {metadata} = DocContent;
|
|
64
|
+
export default function DocItemFooter(): JSX.Element | null {
|
|
65
|
+
const {metadata} = useDoc();
|
|
64
66
|
const {editUrl, lastUpdatedAt, formattedLastUpdatedAt, lastUpdatedBy, tags} =
|
|
65
67
|
metadata;
|
|
66
68
|
|
|
File without changes
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import clsx from 'clsx';
|
|
10
|
+
import {useWindowSize, useDoc} from '@docusaurus/theme-common';
|
|
11
|
+
import DocItemPaginator from '@theme/DocItem/Paginator';
|
|
12
|
+
import DocVersionBanner from '@theme/DocVersionBanner';
|
|
13
|
+
import DocVersionBadge from '@theme/DocVersionBadge';
|
|
14
|
+
import DocItemFooter from '@theme/DocItem/Footer';
|
|
15
|
+
import DocItemTOCMobile from '@theme/DocItem/TOC/Mobile';
|
|
16
|
+
import DocItemTOCDesktop from '@theme/DocItem/TOC/Desktop';
|
|
17
|
+
import DocItemContent from '@theme/DocItem/Content';
|
|
18
|
+
import DocBreadcrumbs from '@theme/DocBreadcrumbs';
|
|
19
|
+
import type {Props} from '@theme/DocItem/Layout';
|
|
20
|
+
|
|
21
|
+
import styles from './styles.module.css';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Decide if the toc should be rendered, on mobile or desktop viewports
|
|
25
|
+
*/
|
|
26
|
+
function useDocTOC() {
|
|
27
|
+
const {frontMatter, toc} = useDoc();
|
|
28
|
+
const windowSize = useWindowSize();
|
|
29
|
+
|
|
30
|
+
const hidden = frontMatter.hide_table_of_contents;
|
|
31
|
+
const canRender = !hidden && toc.length > 0;
|
|
32
|
+
|
|
33
|
+
const mobile = canRender ? <DocItemTOCMobile /> : undefined;
|
|
34
|
+
|
|
35
|
+
const desktop =
|
|
36
|
+
canRender && (windowSize === 'desktop' || windowSize === 'ssr') ? (
|
|
37
|
+
<DocItemTOCDesktop />
|
|
38
|
+
) : undefined;
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
hidden,
|
|
42
|
+
mobile,
|
|
43
|
+
desktop,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export default function DocItemLayout({children}: Props): JSX.Element {
|
|
48
|
+
const docTOC = useDocTOC();
|
|
49
|
+
return (
|
|
50
|
+
<div className="row">
|
|
51
|
+
<div className={clsx('col', !docTOC.hidden && styles.docItemCol)}>
|
|
52
|
+
<DocVersionBanner />
|
|
53
|
+
<div className={styles.docItemContainer}>
|
|
54
|
+
<article>
|
|
55
|
+
<DocBreadcrumbs />
|
|
56
|
+
<DocVersionBadge />
|
|
57
|
+
{docTOC.mobile}
|
|
58
|
+
<DocItemContent>{children}</DocItemContent>
|
|
59
|
+
<DocItemFooter />
|
|
60
|
+
</article>
|
|
61
|
+
<DocItemPaginator />
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
{docTOC.desktop && <div className="col col--3">{docTOC.desktop}</div>}
|
|
65
|
+
</div>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
.docItemContainer header + *,
|
|
9
|
+
.docItemContainer article > *:first-child {
|
|
10
|
+
margin-top: 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@media (min-width: 997px) {
|
|
14
|
+
.docItemCol {
|
|
15
|
+
max-width: 75% !important;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import {PageMetadata, useDoc} from '@docusaurus/theme-common';
|
|
10
|
+
|
|
11
|
+
export default function DocItemMetadata(): JSX.Element {
|
|
12
|
+
const {metadata, frontMatter, assets} = useDoc();
|
|
13
|
+
return (
|
|
14
|
+
<PageMetadata
|
|
15
|
+
title={metadata.title}
|
|
16
|
+
description={metadata.description}
|
|
17
|
+
keywords={frontMatter.keywords}
|
|
18
|
+
image={assets.image ?? frontMatter.image}
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import {useDoc} from '@docusaurus/theme-common';
|
|
10
|
+
import DocPaginator from '@theme/DocPaginator';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* This extra component is needed, because <DocPaginator> should remain generic.
|
|
14
|
+
* DocPaginator is used in non-docs contexts too: generated-index pages...
|
|
15
|
+
*/
|
|
16
|
+
export default function DocItemPaginator(): JSX.Element {
|
|
17
|
+
const {metadata} = useDoc();
|
|
18
|
+
return <DocPaginator previous={metadata.previous} next={metadata.next} />;
|
|
19
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import {ThemeClassNames, useDoc} from '@docusaurus/theme-common';
|
|
10
|
+
|
|
11
|
+
import TOC from '@theme/TOC';
|
|
12
|
+
|
|
13
|
+
export default function DocItemTOCDesktop(): JSX.Element {
|
|
14
|
+
const {toc, frontMatter} = useDoc();
|
|
15
|
+
return (
|
|
16
|
+
<TOC
|
|
17
|
+
toc={toc}
|
|
18
|
+
minHeadingLevel={frontMatter.toc_min_heading_level}
|
|
19
|
+
maxHeadingLevel={frontMatter.toc_max_heading_level}
|
|
20
|
+
className={ThemeClassNames.docs.docTocDesktop}
|
|
21
|
+
/>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import clsx from 'clsx';
|
|
10
|
+
import {ThemeClassNames, useDoc} from '@docusaurus/theme-common';
|
|
11
|
+
import TOCCollapsible from '@theme/TOCCollapsible';
|
|
12
|
+
|
|
13
|
+
import styles from './styles.module.css';
|
|
14
|
+
|
|
15
|
+
export default function DocItemTOCMobile(): JSX.Element {
|
|
16
|
+
const {toc, frontMatter} = useDoc();
|
|
17
|
+
return (
|
|
18
|
+
<TOCCollapsible
|
|
19
|
+
toc={toc}
|
|
20
|
+
minHeadingLevel={frontMatter.toc_min_heading_level}
|
|
21
|
+
maxHeadingLevel={frontMatter.toc_max_heading_level}
|
|
22
|
+
className={clsx(ThemeClassNames.docs.docTocMobile, styles.tocMobile)}
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
@@ -5,16 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
.docItemContainer header + *,
|
|
9
|
-
.docItemContainer article > *:first-child {
|
|
10
|
-
margin-top: 0;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
8
|
@media (min-width: 997px) {
|
|
14
|
-
.docItemCol {
|
|
15
|
-
max-width: 75% !important;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
9
|
/* Prevent hydration FOUC, as the mobile TOC needs to be server-rendered */
|
|
19
10
|
.tocMobile {
|
|
20
11
|
display: none;
|
|
@@ -6,124 +6,22 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
HtmlClassNameProvider,
|
|
13
|
-
ThemeClassNames,
|
|
14
|
-
useWindowSize,
|
|
15
|
-
} from '@docusaurus/theme-common';
|
|
16
|
-
import DocPaginator from '@theme/DocPaginator';
|
|
17
|
-
import DocVersionBanner from '@theme/DocVersionBanner';
|
|
18
|
-
import DocVersionBadge from '@theme/DocVersionBadge';
|
|
19
|
-
import DocItemFooter from '@theme/DocItemFooter';
|
|
20
|
-
import TOC from '@theme/TOC';
|
|
21
|
-
import TOCCollapsible from '@theme/TOCCollapsible';
|
|
22
|
-
import Heading from '@theme/Heading';
|
|
23
|
-
import DocBreadcrumbs from '@theme/DocBreadcrumbs';
|
|
24
|
-
import MDXContent from '@theme/MDXContent';
|
|
9
|
+
import {HtmlClassNameProvider, DocProvider} from '@docusaurus/theme-common';
|
|
10
|
+
import DocItemMetadata from '@theme/DocItem/Metadata';
|
|
11
|
+
import DocItemLayout from '@theme/DocItem/Layout';
|
|
25
12
|
import type {Props} from '@theme/DocItem';
|
|
26
13
|
|
|
27
|
-
import styles from './styles.module.css';
|
|
28
|
-
|
|
29
|
-
function DocItemMetadata(props: Props): JSX.Element {
|
|
30
|
-
const {content: DocContent} = props;
|
|
31
|
-
const {metadata, frontMatter, assets} = DocContent;
|
|
32
|
-
const {keywords} = frontMatter;
|
|
33
|
-
const {description, title} = metadata;
|
|
34
|
-
const image = assets.image ?? frontMatter.image;
|
|
35
|
-
|
|
36
|
-
return <PageMetadata {...{title, description, keywords, image}} />;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function DocItemContent(props: Props): JSX.Element {
|
|
40
|
-
const {content: DocContent} = props;
|
|
41
|
-
const {metadata, frontMatter} = DocContent;
|
|
42
|
-
const {
|
|
43
|
-
hide_title: hideTitle,
|
|
44
|
-
hide_table_of_contents: hideTableOfContents,
|
|
45
|
-
toc_min_heading_level: tocMinHeadingLevel,
|
|
46
|
-
toc_max_heading_level: tocMaxHeadingLevel,
|
|
47
|
-
} = frontMatter;
|
|
48
|
-
const {title} = metadata;
|
|
49
|
-
|
|
50
|
-
// We only add a title if:
|
|
51
|
-
// - user doesn't ask to hide it with front matter
|
|
52
|
-
// - the markdown content does not already contain a top-level h1 heading
|
|
53
|
-
const shouldAddTitle =
|
|
54
|
-
!hideTitle && typeof DocContent.contentTitle === 'undefined';
|
|
55
|
-
|
|
56
|
-
const windowSize = useWindowSize();
|
|
57
|
-
|
|
58
|
-
const canRenderTOC = !hideTableOfContents && DocContent.toc.length > 0;
|
|
59
|
-
|
|
60
|
-
const renderTocDesktop =
|
|
61
|
-
canRenderTOC && (windowSize === 'desktop' || windowSize === 'ssr');
|
|
62
|
-
|
|
63
|
-
return (
|
|
64
|
-
<div className="row">
|
|
65
|
-
<div className={clsx('col', !hideTableOfContents && styles.docItemCol)}>
|
|
66
|
-
<DocVersionBanner />
|
|
67
|
-
<div className={styles.docItemContainer}>
|
|
68
|
-
<article>
|
|
69
|
-
<DocBreadcrumbs />
|
|
70
|
-
<DocVersionBadge />
|
|
71
|
-
|
|
72
|
-
{canRenderTOC && (
|
|
73
|
-
<TOCCollapsible
|
|
74
|
-
toc={DocContent.toc}
|
|
75
|
-
minHeadingLevel={tocMinHeadingLevel}
|
|
76
|
-
maxHeadingLevel={tocMaxHeadingLevel}
|
|
77
|
-
className={clsx(
|
|
78
|
-
ThemeClassNames.docs.docTocMobile,
|
|
79
|
-
styles.tocMobile,
|
|
80
|
-
)}
|
|
81
|
-
/>
|
|
82
|
-
)}
|
|
83
|
-
|
|
84
|
-
<div className={clsx(ThemeClassNames.docs.docMarkdown, 'markdown')}>
|
|
85
|
-
{/*
|
|
86
|
-
Title can be declared inside md content or declared through
|
|
87
|
-
front matter and added manually. To make both cases consistent,
|
|
88
|
-
the added title is added under the same div.markdown block
|
|
89
|
-
See https://github.com/facebook/docusaurus/pull/4882#issuecomment-853021120
|
|
90
|
-
*/}
|
|
91
|
-
{shouldAddTitle && (
|
|
92
|
-
<header>
|
|
93
|
-
<Heading as="h1">{title}</Heading>
|
|
94
|
-
</header>
|
|
95
|
-
)}
|
|
96
|
-
<MDXContent>
|
|
97
|
-
<DocContent />
|
|
98
|
-
</MDXContent>
|
|
99
|
-
</div>
|
|
100
|
-
|
|
101
|
-
<DocItemFooter {...props} />
|
|
102
|
-
</article>
|
|
103
|
-
|
|
104
|
-
<DocPaginator previous={metadata.previous} next={metadata.next} />
|
|
105
|
-
</div>
|
|
106
|
-
</div>
|
|
107
|
-
{renderTocDesktop && (
|
|
108
|
-
<div className="col col--3">
|
|
109
|
-
<TOC
|
|
110
|
-
toc={DocContent.toc}
|
|
111
|
-
minHeadingLevel={tocMinHeadingLevel}
|
|
112
|
-
maxHeadingLevel={tocMaxHeadingLevel}
|
|
113
|
-
className={ThemeClassNames.docs.docTocDesktop}
|
|
114
|
-
/>
|
|
115
|
-
</div>
|
|
116
|
-
)}
|
|
117
|
-
</div>
|
|
118
|
-
);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
14
|
export default function DocItem(props: Props): JSX.Element {
|
|
122
15
|
const docHtmlClassName = `docs-doc-id-${props.content.metadata.unversionedId}`;
|
|
16
|
+
const MDXComponent = props.content;
|
|
123
17
|
return (
|
|
124
|
-
<
|
|
125
|
-
<
|
|
126
|
-
|
|
127
|
-
|
|
18
|
+
<DocProvider content={props.content}>
|
|
19
|
+
<HtmlClassNameProvider className={docHtmlClassName}>
|
|
20
|
+
<DocItemMetadata />
|
|
21
|
+
<DocItemLayout>
|
|
22
|
+
<MDXComponent />
|
|
23
|
+
</DocItemLayout>
|
|
24
|
+
</HtmlClassNameProvider>
|
|
25
|
+
</DocProvider>
|
|
128
26
|
);
|
|
129
27
|
}
|
package/src/theme-classic.d.ts
CHANGED
|
@@ -261,10 +261,40 @@ declare module '@theme/DocCardList' {
|
|
|
261
261
|
export default function DocCardList(props: Props): JSX.Element;
|
|
262
262
|
}
|
|
263
263
|
|
|
264
|
-
declare module '@theme/
|
|
265
|
-
|
|
264
|
+
declare module '@theme/DocItem/Layout' {
|
|
265
|
+
export interface Props {
|
|
266
|
+
readonly children: JSX.Element;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export default function DocItemLayout(props: Props): JSX.Element;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
declare module '@theme/DocItem/Metadata' {
|
|
273
|
+
export default function DocItemMetadata(): JSX.Element;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
declare module '@theme/DocItem/Content' {
|
|
277
|
+
export interface Props {
|
|
278
|
+
readonly children: JSX.Element;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
export default function DocItemContent(props: Props): JSX.Element;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
declare module '@theme/DocItem/TOC/Mobile' {
|
|
285
|
+
export default function DocItemTOCMobile(): JSX.Element;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
declare module '@theme/DocItem/TOC/Desktop' {
|
|
289
|
+
export default function DocItemTOCDesktop(): JSX.Element;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
declare module '@theme/DocItem/Paginator' {
|
|
293
|
+
export default function DocItemPaginator(): JSX.Element;
|
|
294
|
+
}
|
|
266
295
|
|
|
267
|
-
|
|
296
|
+
declare module '@theme/DocItem/Footer' {
|
|
297
|
+
export default function DocItemFooter(): JSX.Element;
|
|
268
298
|
}
|
|
269
299
|
|
|
270
300
|
declare module '@theme/DocPage/Layout' {
|