@docusaurus/theme-classic 2.0.0-beta.8bda3b2db → 2.0.0-beta.9
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/README.md +1 -1
- package/codeTranslations/ar.json +12 -7
- package/codeTranslations/base.json +17 -7
- package/codeTranslations/bn.json +11 -5
- package/codeTranslations/cs.json +62 -0
- package/codeTranslations/da.json +8 -3
- package/codeTranslations/de.json +8 -3
- package/codeTranslations/es.json +15 -10
- package/codeTranslations/fa.json +31 -26
- package/codeTranslations/fil.json +8 -3
- package/codeTranslations/fr.json +8 -3
- package/codeTranslations/he.json +9 -4
- package/codeTranslations/hi.json +9 -4
- package/codeTranslations/ja.json +8 -3
- package/codeTranslations/ko.json +8 -3
- package/codeTranslations/pl.json +8 -3
- package/codeTranslations/pt-BR.json +16 -11
- package/codeTranslations/pt-PT.json +8 -3
- package/codeTranslations/ru.json +10 -5
- package/codeTranslations/sr.json +62 -0
- package/codeTranslations/tr.json +9 -4
- package/codeTranslations/vi.json +10 -5
- package/codeTranslations/zh-Hans.json +9 -4
- package/codeTranslations/zh-Hant.json +9 -4
- package/lib/__tests__/validateThemeConfig.test.js +277 -3
- package/lib/admonitions.css +35 -0
- package/lib/index.js +31 -8
- package/lib/prism-include-languages.js +9 -5
- package/lib/theme/AnnouncementBar/index.js +10 -16
- package/lib/theme/AnnouncementBar/styles.module.css +25 -30
- package/lib/theme/BackToTopButton/index.js +140 -0
- package/lib/theme/BackToTopButton/styles.module.css +42 -0
- package/lib/theme/BlogArchivePage/index.js +89 -0
- package/lib/theme/BlogLayout/index.js +51 -0
- package/lib/theme/BlogListPage/index.js +10 -21
- package/lib/theme/BlogPostAuthor/index.js +51 -0
- package/lib/theme/BlogPostAuthor/styles.module.css +12 -0
- package/lib/theme/BlogPostAuthors/index.js +47 -0
- package/lib/theme/BlogPostAuthors/styles.module.css +11 -0
- package/lib/theme/BlogPostItem/index.js +58 -67
- package/lib/theme/BlogPostPage/index.js +37 -24
- package/lib/theme/BlogSidebar/styles.module.css +2 -2
- package/lib/theme/BlogTagsListPage/index.js +8 -44
- package/lib/theme/BlogTagsPostsPage/index.js +24 -38
- package/lib/theme/CodeBlock/index.js +45 -41
- package/lib/theme/CodeBlock/styles.module.css +6 -9
- package/lib/theme/Details/index.js +30 -0
- package/lib/theme/Details/styles.module.css +13 -0
- package/lib/theme/DocItem/index.js +29 -45
- package/lib/theme/DocItem/styles.module.css +5 -9
- package/lib/theme/DocItemFooter/index.js +79 -0
- package/lib/theme/DocItemFooter/styles.module.css +18 -0
- package/lib/theme/DocPage/index.js +25 -49
- package/lib/theme/DocPage/styles.module.css +8 -23
- package/lib/theme/DocSidebar/index.js +45 -227
- package/lib/theme/DocSidebar/styles.module.css +0 -18
- package/lib/theme/DocSidebarItem/index.js +177 -0
- package/lib/theme/DocSidebarItem/styles.module.css +15 -0
- package/lib/theme/DocTagDocListPage/index.js +89 -0
- package/lib/theme/DocTagsListPage/index.js +44 -0
- package/lib/theme/{DocVersionSuggestions → DocVersionBanner}/index.js +37 -18
- package/lib/theme/EditThisPage/index.js +3 -1
- package/lib/theme/Footer/index.js +13 -4
- package/lib/theme/Heading/index.js +7 -9
- package/lib/theme/Heading/styles.css +4 -6
- package/lib/theme/Heading/styles.module.css +9 -5
- package/lib/theme/IconClose/index.js +31 -0
- package/lib/theme/LastUpdated/index.js +4 -2
- package/lib/theme/LayoutHead/index.js +13 -11
- package/lib/theme/LayoutProviders/index.js +11 -5
- package/lib/theme/Logo/index.js +14 -12
- package/lib/theme/MDXComponents/index.js +45 -4
- package/lib/theme/MDXComponents/styles.css +11 -0
- package/lib/theme/MDXPage/index.js +2 -1
- package/lib/theme/Navbar/index.js +164 -42
- package/lib/theme/Navbar/styles.module.css +10 -3
- package/lib/theme/NavbarItem/DefaultNavbarItem.js +27 -123
- package/lib/theme/NavbarItem/DocNavbarItem.js +6 -5
- package/lib/theme/NavbarItem/DocsVersionDropdownNavbarItem.js +19 -12
- package/lib/theme/NavbarItem/DropdownNavbarItem.js +155 -0
- package/lib/theme/NavbarItem/{LocaleDropdownNavbarItem.js → LocaleDropdownNavbarItem/index.js} +5 -6
- package/lib/theme/NavbarItem/LocaleDropdownNavbarItem/styles.module.css +11 -0
- package/lib/theme/NavbarItem/index.js +31 -11
- package/lib/theme/Seo/index.js +10 -7
- package/lib/theme/SkipToContent/index.js +9 -3
- package/lib/theme/SkipToContent/styles.module.css +1 -0
- package/lib/theme/TOC/index.js +9 -29
- package/lib/theme/TOC/styles.module.css +1 -1
- package/lib/theme/TOCCollapsible/index.js +53 -0
- package/lib/theme/TOCCollapsible/styles.module.css +50 -0
- package/lib/theme/TOCInline/index.js +7 -27
- package/lib/theme/TOCItems/index.js +78 -0
- package/lib/theme/Tabs/__tests__/index.test.js +123 -0
- package/lib/theme/Tabs/index.js +73 -50
- package/lib/theme/Tabs/styles.module.css +0 -13
- package/lib/theme/Tag/index.js +40 -0
- package/lib/theme/Tag/styles.module.css +70 -0
- package/lib/theme/TagsListByLetter/index.js +48 -0
- package/lib/theme/TagsListByLetter/styles.module.css +11 -0
- package/lib/theme/TagsListInline/index.js +44 -0
- package/lib/theme/TagsListInline/styles.module.css +15 -0
- package/lib/theme/ThemedImage/index.js +4 -5
- package/lib/theme/Toggle/index.js +23 -18
- package/lib/theme/Toggle/styles.module.css +91 -0
- package/lib/theme/UserPreferencesProvider/index.js +1 -9
- package/lib/theme/hooks/useHideableNavbar.js +14 -32
- package/lib/theme/hooks/useTabGroupChoice.js +2 -4
- package/lib/theme/hooks/useTheme.js +2 -2
- package/lib/theme/hooks/useWindowSize.js +33 -20
- package/lib/theme/prism-include-languages.js +4 -3
- package/lib/translations.js +4 -4
- package/lib/types.d.ts +338 -138
- package/lib/validateThemeConfig.js +226 -245
- package/lib-next/__tests__/validateThemeConfig.test.js +277 -3
- package/lib-next/admonitions.css +35 -0
- package/lib-next/index.js +33 -7
- package/lib-next/prism-include-languages.js +0 -2
- package/lib-next/theme/AnnouncementBar/index.js +9 -18
- package/lib-next/theme/AnnouncementBar/styles.module.css +25 -30
- package/lib-next/theme/BackToTopButton/index.js +131 -0
- package/lib-next/theme/BackToTopButton/styles.module.css +42 -0
- package/lib-next/theme/BlogArchivePage/index.js +80 -0
- package/lib-next/theme/BlogLayout/index.js +40 -0
- package/lib-next/theme/BlogListPage/index.js +16 -24
- package/lib-next/theme/BlogPostAuthor/index.js +46 -0
- package/lib-next/theme/BlogPostAuthor/styles.module.css +12 -0
- package/lib-next/theme/BlogPostAuthors/index.js +34 -0
- package/lib-next/theme/BlogPostAuthors/styles.module.css +11 -0
- package/lib-next/theme/BlogPostItem/index.js +79 -86
- package/lib-next/theme/BlogPostPage/index.js +70 -35
- package/lib-next/theme/BlogSidebar/styles.module.css +2 -2
- package/lib-next/theme/BlogTagsListPage/index.js +13 -54
- package/lib-next/theme/BlogTagsPostsPage/index.js +28 -38
- package/lib-next/theme/CodeBlock/index.js +54 -53
- package/lib-next/theme/CodeBlock/styles.module.css +6 -9
- package/lib-next/theme/Details/index.js +20 -0
- package/lib-next/theme/Details/styles.module.css +13 -0
- package/lib-next/theme/DocItem/index.js +46 -55
- package/lib-next/theme/DocItem/styles.module.css +5 -9
- package/lib-next/theme/DocItemFooter/index.js +79 -0
- package/lib-next/theme/DocItemFooter/styles.module.css +18 -0
- package/lib-next/theme/DocPage/index.js +25 -43
- package/lib-next/theme/DocPage/styles.module.css +8 -23
- package/lib-next/theme/DocSidebar/index.js +59 -288
- package/lib-next/theme/DocSidebar/styles.module.css +0 -18
- package/lib-next/theme/DocSidebarItem/index.js +181 -0
- package/lib-next/theme/DocSidebarItem/styles.module.css +15 -0
- package/lib-next/theme/DocTagDocListPage/index.js +89 -0
- package/lib-next/theme/DocTagsListPage/index.js +38 -0
- package/lib-next/theme/{DocVersionSuggestions → DocVersionBanner}/index.js +44 -36
- package/lib-next/theme/EditThisPage/index.js +6 -1
- package/lib-next/theme/Footer/index.js +24 -4
- package/lib-next/theme/Heading/index.js +10 -13
- package/lib-next/theme/Heading/styles.css +4 -6
- package/lib-next/theme/Heading/styles.module.css +9 -5
- package/lib-next/theme/IconClose/index.js +23 -0
- package/lib-next/theme/LastUpdated/index.js +3 -2
- package/lib-next/theme/LayoutHead/index.js +9 -15
- package/lib-next/theme/LayoutProviders/index.js +17 -6
- package/lib-next/theme/Logo/index.js +23 -19
- package/lib-next/theme/MDXComponents/index.js +34 -7
- package/lib-next/theme/MDXComponents/styles.css +11 -0
- package/lib-next/theme/MDXPage/index.js +10 -2
- package/lib-next/theme/Navbar/index.js +192 -56
- package/lib-next/theme/Navbar/styles.module.css +10 -3
- package/lib-next/theme/NavbarItem/DefaultNavbarItem.js +45 -147
- package/lib-next/theme/NavbarItem/DocNavbarItem.js +6 -5
- package/lib-next/theme/NavbarItem/DocsVersionDropdownNavbarItem.js +31 -19
- package/lib-next/theme/NavbarItem/DropdownNavbarItem.js +158 -0
- package/lib-next/theme/NavbarItem/{LocaleDropdownNavbarItem.js → LocaleDropdownNavbarItem/index.js} +4 -8
- package/lib-next/theme/NavbarItem/LocaleDropdownNavbarItem/styles.module.css +11 -0
- package/lib-next/theme/NavbarItem/index.js +25 -12
- package/lib-next/theme/Seo/index.js +11 -7
- package/lib-next/theme/SkipToContent/index.js +5 -6
- package/lib-next/theme/SkipToContent/styles.module.css +1 -0
- package/lib-next/theme/TOC/index.js +12 -36
- package/lib-next/theme/TOC/styles.module.css +1 -1
- package/lib-next/theme/TOCCollapsible/index.js +54 -0
- package/lib-next/theme/TOCCollapsible/styles.module.css +50 -0
- package/lib-next/theme/TOCInline/index.js +10 -28
- package/lib-next/theme/TOCItems/index.js +85 -0
- package/lib-next/theme/Tabs/__tests__/index.test.js +142 -0
- package/lib-next/theme/Tabs/index.js +91 -43
- package/lib-next/theme/Tabs/styles.module.css +0 -13
- package/lib-next/theme/Tag/index.js +27 -0
- package/lib-next/theme/Tag/styles.module.css +70 -0
- package/lib-next/theme/TagsListByLetter/index.js +42 -0
- package/lib-next/theme/TagsListByLetter/styles.module.css +11 -0
- package/lib-next/theme/TagsListInline/index.js +31 -0
- package/lib-next/theme/TagsListInline/styles.module.css +15 -0
- package/lib-next/theme/ThemedImage/index.js +5 -6
- package/lib-next/theme/Toggle/index.js +20 -15
- package/lib-next/theme/Toggle/styles.module.css +91 -0
- package/lib-next/theme/UserPreferencesProvider/index.js +0 -4
- package/lib-next/theme/hooks/useHideableNavbar.js +31 -44
- package/lib-next/theme/hooks/useTabGroupChoice.js +2 -4
- package/lib-next/theme/hooks/useTheme.js +2 -2
- package/lib-next/theme/hooks/useWindowSize.js +34 -20
- package/lib-next/theme/prism-include-languages.js +2 -1
- package/lib-next/translations.js +6 -10
- package/lib-next/types.d.ts +338 -138
- package/lib-next/validateThemeConfig.js +134 -110
- package/package.json +24 -19
- package/src/__tests__/validateThemeConfig.test.js +277 -3
- package/src/admonitions.css +35 -0
- package/src/index.ts +44 -14
- package/src/{prism-include-languages.js → prism-include-languages.ts} +0 -0
- package/src/theme/AnnouncementBar/index.tsx +10 -17
- package/src/theme/AnnouncementBar/styles.module.css +25 -30
- package/src/theme/BackToTopButton/index.tsx +142 -0
- package/src/theme/BackToTopButton/styles.module.css +42 -0
- package/src/theme/BlogArchivePage/index.tsx +91 -0
- package/src/theme/BlogLayout/index.tsx +44 -0
- package/src/theme/BlogListPage/index.tsx +17 -24
- package/src/theme/BlogPostAuthor/index.tsx +49 -0
- package/src/theme/BlogPostAuthor/styles.module.css +12 -0
- package/src/theme/BlogPostAuthors/index.tsx +36 -0
- package/src/theme/BlogPostAuthors/styles.module.css +11 -0
- package/src/theme/BlogPostItem/index.tsx +70 -80
- package/src/theme/BlogPostPage/index.tsx +72 -35
- package/src/theme/BlogSidebar/styles.module.css +2 -2
- package/src/theme/BlogTagsListPage/index.tsx +13 -56
- package/src/theme/BlogTagsPostsPage/index.tsx +28 -38
- package/src/theme/CodeBlock/index.tsx +70 -55
- package/src/theme/CodeBlock/styles.module.css +6 -9
- package/src/theme/Details/index.tsx +24 -0
- package/src/theme/Details/styles.module.css +13 -0
- package/src/theme/DocItem/index.tsx +49 -55
- package/src/theme/DocItem/styles.module.css +5 -9
- package/src/theme/DocItemFooter/index.tsx +91 -0
- package/src/theme/DocItemFooter/styles.module.css +18 -0
- package/src/theme/DocPage/index.tsx +24 -38
- package/src/theme/DocPage/styles.module.css +8 -23
- package/src/theme/DocSidebar/index.tsx +70 -300
- package/src/theme/DocSidebar/styles.module.css +0 -18
- package/src/theme/DocSidebarItem/index.tsx +206 -0
- package/src/theme/DocSidebarItem/styles.module.css +15 -0
- package/src/theme/DocTagDocListPage/index.tsx +89 -0
- package/src/theme/DocTagsListPage/index.tsx +41 -0
- package/src/theme/{DocVersionSuggestions → DocVersionBanner}/index.tsx +58 -44
- package/src/theme/EditThisPage/index.tsx +6 -1
- package/src/theme/Footer/index.tsx +26 -4
- package/src/theme/Heading/index.tsx +10 -13
- package/src/theme/Heading/styles.css +4 -6
- package/src/theme/Heading/styles.module.css +9 -5
- package/src/theme/IconClose/index.tsx +26 -0
- package/src/theme/LastUpdated/index.tsx +3 -2
- package/src/theme/LayoutHead/index.tsx +9 -9
- package/src/theme/LayoutProviders/index.tsx +17 -6
- package/src/theme/Logo/index.tsx +19 -15
- package/src/theme/MDXComponents/index.tsx +39 -5
- package/src/theme/MDXComponents/styles.css +11 -0
- package/src/theme/MDXPage/index.tsx +10 -2
- package/src/theme/Navbar/index.tsx +202 -61
- package/src/theme/Navbar/styles.module.css +10 -3
- package/src/theme/NavbarItem/DefaultNavbarItem.tsx +42 -154
- package/src/theme/NavbarItem/DocNavbarItem.tsx +11 -14
- package/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx +33 -21
- package/src/theme/NavbarItem/DocsVersionNavbarItem.tsx +7 -3
- package/src/theme/NavbarItem/DropdownNavbarItem.tsx +180 -0
- package/src/theme/NavbarItem/{LocaleDropdownNavbarItem.tsx → LocaleDropdownNavbarItem/index.tsx} +8 -7
- package/src/theme/NavbarItem/LocaleDropdownNavbarItem/styles.module.css +11 -0
- package/src/theme/NavbarItem/index.tsx +41 -16
- package/src/theme/Seo/index.tsx +7 -4
- package/src/theme/SkipToContent/index.tsx +5 -6
- package/src/theme/SkipToContent/styles.module.css +1 -0
- package/src/theme/TOC/index.tsx +12 -41
- package/src/theme/TOC/styles.module.css +1 -1
- package/src/theme/TOCCollapsible/index.tsx +58 -0
- package/src/theme/TOCCollapsible/styles.module.css +50 -0
- package/src/theme/TOCInline/index.tsx +13 -32
- package/src/theme/TOCItems/index.tsx +96 -0
- package/src/theme/Tabs/__tests__/index.test.tsx +129 -0
- package/src/theme/Tabs/index.tsx +93 -49
- package/src/theme/Tabs/styles.module.css +0 -13
- package/src/theme/Tag/index.tsx +31 -0
- package/src/theme/Tag/styles.module.css +70 -0
- package/src/theme/TagsListByLetter/index.tsx +45 -0
- package/src/theme/TagsListByLetter/styles.module.css +11 -0
- package/src/theme/TagsListInline/index.tsx +35 -0
- package/src/theme/TagsListInline/styles.module.css +15 -0
- package/src/theme/ThemedImage/index.tsx +6 -6
- package/src/theme/Toggle/index.tsx +20 -15
- package/src/theme/Toggle/styles.module.css +91 -0
- package/src/theme/UserPreferencesProvider/index.tsx +0 -5
- package/src/theme/hooks/useContextualSearchFilters.ts +1 -1
- package/src/theme/hooks/useHideableNavbar.ts +32 -45
- package/src/theme/hooks/useTabGroupChoice.ts +4 -4
- package/src/theme/hooks/useTheme.ts +2 -2
- package/src/theme/hooks/useWindowSize.ts +38 -20
- package/src/theme/prism-include-languages.ts +3 -2
- package/src/translations.ts +6 -10
- package/src/types.d.ts +338 -138
- package/src/{validateThemeConfig.js → validateThemeConfig.ts} +144 -90
- package/tsconfig.json +1 -2
- package/update-code-translations.js +10 -6
- package/update-code-translations.test.js +1 -1
- package/update.js +151 -0
- package/lib/theme/Toggle/styles.css +0 -103
- package/lib/theme/hooks/useAnnouncementBar.js +0 -63
- package/lib/theme/hooks/useScrollPosition.js +0 -49
- package/lib/theme/hooks/useTOCHighlight.js +0 -87
- package/lib-next/theme/Toggle/styles.css +0 -103
- package/lib-next/theme/hooks/useAnnouncementBar.js +0 -49
- package/lib-next/theme/hooks/useScrollPosition.js +0 -38
- package/lib-next/theme/hooks/useTOCHighlight.js +0 -84
- package/src/theme/Toggle/styles.css +0 -103
- package/src/theme/hooks/useAnnouncementBar.ts +0 -58
- package/src/theme/hooks/useScrollPosition.ts +0 -45
- package/src/theme/hooks/useTOCHighlight.ts +0 -98
|
@@ -5,50 +5,85 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
|
-
import
|
|
8
|
+
import Seo from '@theme/Seo';
|
|
9
|
+
import BlogLayout from '@theme/BlogLayout';
|
|
9
10
|
import BlogPostItem from '@theme/BlogPostItem';
|
|
10
11
|
import BlogPostPaginator from '@theme/BlogPostPaginator';
|
|
11
|
-
import BlogSidebar from '@theme/BlogSidebar';
|
|
12
|
-
import TOC from '@theme/TOC';
|
|
13
12
|
import {ThemeClassNames} from '@docusaurus/theme-common';
|
|
13
|
+
import TOC from '@theme/TOC';
|
|
14
14
|
|
|
15
15
|
function BlogPostPage(props) {
|
|
16
16
|
const {content: BlogPostContents, sidebar} = props;
|
|
17
|
-
const {
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
const {
|
|
18
|
+
// TODO this frontmatter is not validated/normalized, it's the raw user-provided one. We should expose normalized one too!
|
|
19
|
+
frontMatter,
|
|
20
|
+
assets,
|
|
21
|
+
metadata,
|
|
22
|
+
} = BlogPostContents;
|
|
23
|
+
const {title, description, nextItem, prevItem, date, tags, authors} =
|
|
24
|
+
metadata;
|
|
25
|
+
const {
|
|
26
|
+
hide_table_of_contents: hideTableOfContents,
|
|
27
|
+
keywords,
|
|
28
|
+
toc_min_heading_level: tocMinHeadingLevel,
|
|
29
|
+
toc_max_heading_level: tocMaxHeadingLevel,
|
|
30
|
+
} = frontMatter;
|
|
31
|
+
const image = assets.image ?? frontMatter.image;
|
|
20
32
|
return (
|
|
21
|
-
<
|
|
22
|
-
title={title}
|
|
23
|
-
description={description}
|
|
33
|
+
<BlogLayout
|
|
24
34
|
wrapperClassName={ThemeClassNames.wrapper.blogPages}
|
|
25
|
-
pageClassName={ThemeClassNames.page.blogPostPage}
|
|
26
|
-
{
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
35
|
+
pageClassName={ThemeClassNames.page.blogPostPage}
|
|
36
|
+
sidebar={sidebar}
|
|
37
|
+
toc={
|
|
38
|
+
!hideTableOfContents &&
|
|
39
|
+
BlogPostContents.toc &&
|
|
40
|
+
BlogPostContents.toc.length > 0 ? (
|
|
41
|
+
<TOC
|
|
42
|
+
toc={BlogPostContents.toc}
|
|
43
|
+
minHeadingLevel={tocMinHeadingLevel}
|
|
44
|
+
maxHeadingLevel={tocMaxHeadingLevel}
|
|
45
|
+
/>
|
|
46
|
+
) : undefined
|
|
47
|
+
}>
|
|
48
|
+
<Seo // TODO refactor needed: it's a bit annoying but Seo MUST be inside BlogLayout
|
|
49
|
+
// otherwise default image (set by BlogLayout) would shadow the custom blog post image
|
|
50
|
+
title={title}
|
|
51
|
+
description={description}
|
|
52
|
+
keywords={keywords}
|
|
53
|
+
image={image}>
|
|
54
|
+
<meta property="og:type" content="article" />
|
|
55
|
+
<meta property="article:published_time" content={date} />
|
|
56
|
+
|
|
57
|
+
{/* TODO double check those article metas array syntaxes, see https://ogp.me/#array */}
|
|
58
|
+
{authors.some((author) => author.url) && (
|
|
59
|
+
<meta
|
|
60
|
+
property="article:author"
|
|
61
|
+
content={authors
|
|
62
|
+
.map((author) => author.url)
|
|
63
|
+
.filter(Boolean)
|
|
64
|
+
.join(',')}
|
|
65
|
+
/>
|
|
66
|
+
)}
|
|
67
|
+
{tags.length > 0 && (
|
|
68
|
+
<meta
|
|
69
|
+
property="article:tag"
|
|
70
|
+
content={tags.map((tag) => tag.label).join(',')}
|
|
71
|
+
/>
|
|
72
|
+
)}
|
|
73
|
+
</Seo>
|
|
74
|
+
|
|
75
|
+
<BlogPostItem
|
|
76
|
+
frontMatter={frontMatter}
|
|
77
|
+
assets={assets}
|
|
78
|
+
metadata={metadata}
|
|
79
|
+
isBlogPostPage>
|
|
80
|
+
<BlogPostContents />
|
|
81
|
+
</BlogPostItem>
|
|
82
|
+
|
|
83
|
+
{(nextItem || prevItem) && (
|
|
84
|
+
<BlogPostPaginator nextItem={nextItem} prevItem={prevItem} />
|
|
50
85
|
)}
|
|
51
|
-
</
|
|
86
|
+
</BlogLayout>
|
|
52
87
|
);
|
|
53
88
|
}
|
|
54
89
|
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
text-decoration: none;
|
|
35
35
|
}
|
|
36
36
|
.sidebarItemLinkActive {
|
|
37
|
-
color: var(--ifm-color-primary);
|
|
37
|
+
color: var(--ifm-color-primary) !important;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
@media
|
|
40
|
+
@media (max-width: 996px) {
|
|
41
41
|
.sidebar {
|
|
42
42
|
display: none;
|
|
43
43
|
}
|
|
@@ -5,70 +5,29 @@
|
|
|
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
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
function getCategoryOfTag(tag) {
|
|
15
|
-
// tag's category should be customizable
|
|
16
|
-
return tag[0].toUpperCase();
|
|
17
|
-
}
|
|
8
|
+
import BlogLayout from '@theme/BlogLayout';
|
|
9
|
+
import TagsListByLetter from '@theme/TagsListByLetter';
|
|
10
|
+
import {
|
|
11
|
+
ThemeClassNames,
|
|
12
|
+
translateTagsPageTitle,
|
|
13
|
+
} from '@docusaurus/theme-common';
|
|
18
14
|
|
|
19
15
|
function BlogTagsListPage(props) {
|
|
20
16
|
const {tags, sidebar} = props;
|
|
21
|
-
const title =
|
|
22
|
-
id: 'theme.tags.tagsPageTitle',
|
|
23
|
-
message: 'Tags',
|
|
24
|
-
description: 'The title of the tag list page',
|
|
25
|
-
});
|
|
26
|
-
const tagCategories = {};
|
|
27
|
-
Object.keys(tags).forEach((tag) => {
|
|
28
|
-
const category = getCategoryOfTag(tag);
|
|
29
|
-
tagCategories[category] = tagCategories[category] || [];
|
|
30
|
-
tagCategories[category].push(tag);
|
|
31
|
-
});
|
|
32
|
-
const tagsList = Object.entries(tagCategories).sort(([a], [b]) =>
|
|
33
|
-
a.localeCompare(b),
|
|
34
|
-
);
|
|
35
|
-
const tagsSection = tagsList
|
|
36
|
-
.map(([category, tagsForCategory]) => (
|
|
37
|
-
<article key={category}>
|
|
38
|
-
<h2>{category}</h2>
|
|
39
|
-
{tagsForCategory.map((tag) => (
|
|
40
|
-
<Link
|
|
41
|
-
className="padding-right--md"
|
|
42
|
-
href={tags[tag].permalink}
|
|
43
|
-
key={tag}>
|
|
44
|
-
{tags[tag].name} ({tags[tag].count})
|
|
45
|
-
</Link>
|
|
46
|
-
))}
|
|
47
|
-
<hr />
|
|
48
|
-
</article>
|
|
49
|
-
))
|
|
50
|
-
.filter((item) => item != null);
|
|
17
|
+
const title = translateTagsPageTitle();
|
|
51
18
|
return (
|
|
52
|
-
<
|
|
19
|
+
<BlogLayout
|
|
53
20
|
title={title}
|
|
54
21
|
wrapperClassName={ThemeClassNames.wrapper.blogPages}
|
|
55
22
|
pageClassName={ThemeClassNames.page.blogTagsListPage}
|
|
56
23
|
searchMetadatas={{
|
|
57
24
|
// assign unique search tag to exclude this page from search results!
|
|
58
25
|
tag: 'blog_tags_list',
|
|
59
|
-
}}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
</aside>
|
|
65
|
-
<main className="col col--7">
|
|
66
|
-
<h1>{title}</h1>
|
|
67
|
-
<section className="margin-vert--lg">{tagsSection}</section>
|
|
68
|
-
</main>
|
|
69
|
-
</div>
|
|
70
|
-
</div>
|
|
71
|
-
</Layout>
|
|
26
|
+
}}
|
|
27
|
+
sidebar={sidebar}>
|
|
28
|
+
<h1>{title}</h1>
|
|
29
|
+
<TagsListByLetter tags={Object.values(tags)} />
|
|
30
|
+
</BlogLayout>
|
|
72
31
|
);
|
|
73
32
|
}
|
|
74
33
|
|
|
@@ -5,10 +5,9 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
|
-
import Layout from '@theme/Layout';
|
|
9
|
-
import BlogPostItem from '@theme/BlogPostItem';
|
|
10
8
|
import Link from '@docusaurus/Link';
|
|
11
|
-
import
|
|
9
|
+
import BlogLayout from '@theme/BlogLayout';
|
|
10
|
+
import BlogPostItem from '@theme/BlogPostItem';
|
|
12
11
|
import Translate, {translate} from '@docusaurus/Translate';
|
|
13
12
|
import {ThemeClassNames, usePluralForm} from '@docusaurus/theme-common'; // Very simple pluralization: probably good enough for now
|
|
14
13
|
|
|
@@ -31,7 +30,7 @@ function useBlogPostsPlural() {
|
|
|
31
30
|
);
|
|
32
31
|
}
|
|
33
32
|
|
|
34
|
-
function
|
|
33
|
+
export default function BlogTagsPostsPage(props) {
|
|
35
34
|
const {metadata, items, sidebar} = props;
|
|
36
35
|
const {allTagsPath, name: tagName, count} = metadata;
|
|
37
36
|
const blogPostsPlural = useBlogPostsPlural();
|
|
@@ -47,46 +46,37 @@ function BlogTagsPostPage(props) {
|
|
|
47
46
|
},
|
|
48
47
|
);
|
|
49
48
|
return (
|
|
50
|
-
<
|
|
49
|
+
<BlogLayout
|
|
51
50
|
title={title}
|
|
52
51
|
wrapperClassName={ThemeClassNames.wrapper.blogPages}
|
|
53
|
-
pageClassName={ThemeClassNames.page.
|
|
52
|
+
pageClassName={ThemeClassNames.page.blogTagPostListPage}
|
|
54
53
|
searchMetadatas={{
|
|
55
54
|
// assign unique search tag to exclude this page from search results!
|
|
56
55
|
tag: 'blog_tags_posts',
|
|
57
|
-
}}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
<BlogSidebar sidebar={sidebar} />
|
|
62
|
-
</aside>
|
|
63
|
-
<main className="col col--7">
|
|
64
|
-
<header className="margin-bottom--xl">
|
|
65
|
-
<h1>{title}</h1>
|
|
56
|
+
}}
|
|
57
|
+
sidebar={sidebar}>
|
|
58
|
+
<header className="margin-bottom--xl">
|
|
59
|
+
<h1>{title}</h1>
|
|
66
60
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
61
|
+
<Link href={allTagsPath}>
|
|
62
|
+
<Translate
|
|
63
|
+
id="theme.tags.tagsPageLink"
|
|
64
|
+
description="The label of the link targeting the tag list page">
|
|
65
|
+
View All Tags
|
|
66
|
+
</Translate>
|
|
67
|
+
</Link>
|
|
68
|
+
</header>
|
|
75
69
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
</div>
|
|
88
|
-
</Layout>
|
|
70
|
+
{items.map(({content: BlogPostContent}) => (
|
|
71
|
+
<BlogPostItem
|
|
72
|
+
key={BlogPostContent.metadata.permalink}
|
|
73
|
+
frontMatter={BlogPostContent.frontMatter}
|
|
74
|
+
assets={BlogPostContent.assets}
|
|
75
|
+
metadata={BlogPostContent.metadata}
|
|
76
|
+
truncated>
|
|
77
|
+
<BlogPostContent />
|
|
78
|
+
</BlogPostItem>
|
|
79
|
+
))}
|
|
80
|
+
</BlogLayout>
|
|
89
81
|
);
|
|
90
82
|
}
|
|
91
|
-
|
|
92
|
-
export default BlogTagsPostPage;
|
|
@@ -13,46 +13,45 @@ import usePrismTheme from '@theme/hooks/usePrismTheme';
|
|
|
13
13
|
import Translate, {translate} from '@docusaurus/Translate';
|
|
14
14
|
import styles from './styles.module.css';
|
|
15
15
|
import {useThemeConfig, parseCodeBlockTitle} from '@docusaurus/theme-common';
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
16
|
+
const HighlightLinesRangeRegex = /{([\d,-]+)}/;
|
|
17
|
+
const HighlightLanguages = ['js', 'jsBlock', 'jsx', 'python', 'html'];
|
|
18
|
+
// Supported types of highlight comments
|
|
19
|
+
const HighlightComments = {
|
|
20
|
+
js: {
|
|
21
|
+
start: '\\/\\/',
|
|
22
|
+
end: '',
|
|
23
|
+
},
|
|
24
|
+
jsBlock: {
|
|
25
|
+
start: '\\/\\*',
|
|
26
|
+
end: '\\*\\/',
|
|
27
|
+
},
|
|
28
|
+
jsx: {
|
|
29
|
+
start: '\\{\\s*\\/\\*',
|
|
30
|
+
end: '\\*\\/\\s*\\}',
|
|
31
|
+
},
|
|
32
|
+
python: {
|
|
33
|
+
start: '#',
|
|
34
|
+
end: '',
|
|
35
|
+
},
|
|
36
|
+
html: {
|
|
37
|
+
start: '<!--',
|
|
38
|
+
end: '-->',
|
|
39
|
+
},
|
|
40
|
+
}; // Supported highlight directives
|
|
41
|
+
|
|
42
|
+
const HighlightDirectives = [
|
|
43
|
+
'highlight-next-line',
|
|
44
|
+
'highlight-start',
|
|
45
|
+
'highlight-end',
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
const getHighlightDirectiveRegex = (languages = HighlightLanguages) => {
|
|
49
|
+
// to be more reliable, the opening and closing comment must match
|
|
51
50
|
const commentPattern = languages
|
|
52
|
-
.map(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
)
|
|
51
|
+
.map((lang) => {
|
|
52
|
+
const {start, end} = HighlightComments[lang];
|
|
53
|
+
return `(?:${start}\\s*(${HighlightDirectives.join('|')})\\s*${end})`;
|
|
54
|
+
})
|
|
56
55
|
.join('|'); // white space is allowed, but otherwise it should be on it's own line
|
|
57
56
|
|
|
58
57
|
return new RegExp(`^\\s*(?:${commentPattern})\\s*$`);
|
|
@@ -85,7 +84,7 @@ const highlightDirectiveRegex = (lang) => {
|
|
|
85
84
|
|
|
86
85
|
export default function CodeBlock({
|
|
87
86
|
children,
|
|
88
|
-
className:
|
|
87
|
+
className: blockClassName,
|
|
89
88
|
metastring,
|
|
90
89
|
title,
|
|
91
90
|
}) {
|
|
@@ -112,17 +111,16 @@ export default function CodeBlock({
|
|
|
112
111
|
|
|
113
112
|
const content = Array.isArray(children) ? children.join('') : children;
|
|
114
113
|
|
|
115
|
-
if (metastring &&
|
|
114
|
+
if (metastring && HighlightLinesRangeRegex.test(metastring)) {
|
|
116
115
|
// Tested above
|
|
117
|
-
|
|
118
|
-
const highlightLinesRange = metastring.match(highlightLinesRangeRegex)[1];
|
|
116
|
+
const highlightLinesRange = metastring.match(HighlightLinesRangeRegex)[1];
|
|
119
117
|
highlightLines = rangeParser(highlightLinesRange).filter((n) => n > 0);
|
|
120
118
|
}
|
|
121
119
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
120
|
+
const languageClassName = blockClassName
|
|
121
|
+
?.split(' ')
|
|
122
|
+
.find((str) => str.startsWith('language-'));
|
|
123
|
+
let language = languageClassName?.replace(/language-/, '');
|
|
126
124
|
|
|
127
125
|
if (!language && prism.defaultLanguage) {
|
|
128
126
|
language = prism.defaultLanguage;
|
|
@@ -190,7 +188,11 @@ export default function CodeBlock({
|
|
|
190
188
|
code={code}
|
|
191
189
|
language={language}>
|
|
192
190
|
{({className, style, tokens, getLineProps, getTokenProps}) => (
|
|
193
|
-
<div
|
|
191
|
+
<div
|
|
192
|
+
className={clsx(
|
|
193
|
+
styles.codeBlockContainer,
|
|
194
|
+
blockClassName?.replace(/language-[^ ]+/, ''),
|
|
195
|
+
)}>
|
|
194
196
|
{codeBlockTitle && (
|
|
195
197
|
<div style={style} className={styles.codeBlockTitle}>
|
|
196
198
|
{codeBlockTitle}
|
|
@@ -200,14 +202,12 @@ export default function CodeBlock({
|
|
|
200
202
|
<pre
|
|
201
203
|
/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */
|
|
202
204
|
tabIndex={0}
|
|
203
|
-
className={clsx(className, styles.codeBlock, 'thin-scrollbar'
|
|
204
|
-
[styles.codeBlockWithTitle]: codeBlockTitle,
|
|
205
|
-
})}
|
|
205
|
+
className={clsx(className, styles.codeBlock, 'thin-scrollbar')}
|
|
206
206
|
style={style}>
|
|
207
207
|
<code className={styles.codeBlockLines}>
|
|
208
208
|
{tokens.map((line, i) => {
|
|
209
|
-
if (line.length === 1 && line[0].content === '') {
|
|
210
|
-
line[0].content = '
|
|
209
|
+
if (line.length === 1 && line[0].content === '\n') {
|
|
210
|
+
line[0].content = '';
|
|
211
211
|
}
|
|
212
212
|
|
|
213
213
|
const lineProps = getLineProps({
|
|
@@ -230,6 +230,7 @@ export default function CodeBlock({
|
|
|
230
230
|
})}
|
|
231
231
|
/>
|
|
232
232
|
))}
|
|
233
|
+
<br />
|
|
233
234
|
</span>
|
|
234
235
|
);
|
|
235
236
|
})}
|
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
|
|
8
8
|
.codeBlockContainer {
|
|
9
9
|
margin-bottom: var(--ifm-leading);
|
|
10
|
+
border-radius: var(--ifm-global-radius);
|
|
11
|
+
box-shadow: var(--ifm-global-shadow-lw);
|
|
12
|
+
overflow: hidden;
|
|
10
13
|
}
|
|
11
14
|
|
|
12
15
|
.codeBlockContent {
|
|
@@ -16,8 +19,6 @@
|
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
.codeBlockTitle {
|
|
19
|
-
border-top-left-radius: var(--ifm-global-radius);
|
|
20
|
-
border-top-right-radius: var(--ifm-global-radius);
|
|
21
22
|
border-bottom: 1px solid var(--ifm-color-emphasis-300);
|
|
22
23
|
font-size: var(--ifm-code-font-size);
|
|
23
24
|
font-weight: 500;
|
|
@@ -25,12 +26,9 @@
|
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
.codeBlock {
|
|
29
|
+
margin: 0;
|
|
28
30
|
padding: 0;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
.codeBlockWithTitle {
|
|
32
|
-
border-top-left-radius: 0;
|
|
33
|
-
border-top-right-radius: 0;
|
|
31
|
+
border-radius: 0;
|
|
34
32
|
}
|
|
35
33
|
|
|
36
34
|
.copyButton {
|
|
@@ -54,11 +52,10 @@
|
|
|
54
52
|
|
|
55
53
|
.codeBlockLines {
|
|
56
54
|
font: inherit;
|
|
55
|
+
/*rtl:ignore*/
|
|
57
56
|
float: left;
|
|
58
57
|
min-width: 100%;
|
|
59
58
|
padding: var(--ifm-pre-padding);
|
|
60
|
-
display: flex;
|
|
61
|
-
flex-direction: column;
|
|
62
59
|
}
|
|
63
60
|
|
|
64
61
|
@media print {
|
|
@@ -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 clsx from 'clsx';
|
|
9
|
+
import {Details as DetailsGeneric} from '@docusaurus/theme-common';
|
|
10
|
+
import styles from './styles.module.css'; // Should we have a custom details/summary comp in Infima instead of reusing alert classes?
|
|
11
|
+
|
|
12
|
+
const InfimaClasses = 'alert alert--info';
|
|
13
|
+
export default function Details({...props}) {
|
|
14
|
+
return (
|
|
15
|
+
<DetailsGeneric
|
|
16
|
+
{...props}
|
|
17
|
+
className={clsx(InfimaClasses, styles.details, props.className)}
|
|
18
|
+
/>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
.details {
|
|
9
|
+
--docusaurus-details-decoration-color: var(--ifm-alert-border-color);
|
|
10
|
+
--docusaurus-details-transition: transform var(--ifm-transition-fast) ease;
|
|
11
|
+
margin: 0 0 var(--ifm-spacing-vertical);
|
|
12
|
+
border: 1px solid var(--ifm-alert-border-color);
|
|
13
|
+
}
|