@docusaurus/theme-classic 2.0.0-beta.1 → 2.0.0-beta.10
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/lib/__tests__/validateThemeConfig.test.js +277 -3
- package/lib/admonitions.css +35 -0
- package/lib/deps.d.ts +13 -0
- package/lib/index.js +41 -16
- 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/index.js +5 -7
- 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 +18 -138
- 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/DocCard/index.js +84 -0
- package/lib/theme/DocCard/styles.module.css +43 -0
- package/lib/theme/DocCardList/index.js +28 -0
- package/lib/theme/DocCategoryGeneratedIndexPage/index.js +57 -0
- package/lib/theme/DocCategoryGeneratedIndexPage/styles.module.css +18 -0
- package/lib/theme/DocItem/index.js +29 -46
- 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 +35 -52
- package/lib/theme/DocPage/styles.module.css +8 -23
- package/lib/theme/DocPaginator/index.js +6 -7
- package/lib/theme/DocSidebar/index.js +53 -235
- package/lib/theme/DocSidebar/styles.module.css +0 -18
- package/lib/theme/DocSidebarItem/index.js +209 -0
- package/lib/theme/DocSidebarItem/styles.module.css +19 -0
- package/lib/theme/DocTagDocListPage/index.js +89 -0
- package/lib/theme/DocTagsListPage/index.js +44 -0
- package/lib/theme/DocVersionBadge/index.js +34 -0
- package/lib/theme/{DocVersionSuggestions → DocVersionBanner}/index.js +39 -20
- package/lib/theme/EditThisPage/index.js +3 -1
- package/lib/theme/ErrorPageContent.js +43 -0
- package/lib/theme/Footer/index.js +16 -5
- package/lib/theme/Heading/index.js +17 -22
- package/lib/theme/Heading/styles.css +5 -6
- package/lib/theme/Heading/styles.module.css +9 -5
- package/lib/theme/IconArrow/index.js +2 -2
- package/lib/theme/IconClose/index.js +31 -0
- package/lib/theme/IconEdit/index.js +3 -3
- package/lib/theme/IconExternalLink/index.js +3 -3
- package/lib/theme/IconLanguage/index.js +3 -3
- package/lib/theme/IconMenu/index.js +3 -3
- package/lib/theme/LastUpdated/index.js +4 -2
- package/lib/theme/Layout/index.js +5 -1
- package/lib/theme/LayoutHead/index.js +22 -17
- package/lib/theme/LayoutProviders/index.js +11 -5
- package/lib/theme/Logo/index.js +16 -14
- 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 +162 -42
- package/lib/theme/Navbar/styles.module.css +10 -3
- package/lib/theme/NavbarItem/DefaultNavbarItem.js +27 -123
- package/lib/theme/NavbarItem/DocNavbarItem.js +7 -8
- 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} +6 -10
- package/lib/theme/NavbarItem/LocaleDropdownNavbarItem/styles.module.css +11 -0
- package/lib/theme/NavbarItem/index.js +31 -11
- package/lib/theme/{SearchMetadatas → SearchMetadata}/index.js +2 -2
- package/lib/theme/Seo/index.js +10 -7
- package/lib/theme/SkipToContent/index.js +12 -4
- 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/ThemeProvider/index.js +8 -3
- package/lib/theme/ThemedImage/index.js +6 -7
- package/lib/theme/Toggle/index.js +41 -44
- package/lib/theme/Toggle/styles.module.css +91 -3
- package/lib/theme/UserPreferencesProvider/index.js +9 -12
- package/lib/theme/hooks/useHideableNavbar.js +14 -32
- package/lib/theme/hooks/useTabGroupChoice.js +2 -4
- package/lib/theme/hooks/useTheme.js +3 -5
- package/lib/theme/hooks/useWindowSize.js +33 -20
- package/lib/theme/prism-include-languages.js +4 -3
- package/lib/theme-classic.d.ts +806 -0
- package/lib/translations.js +4 -4
- package/lib/types.d.ts +0 -599
- package/lib/validateThemeConfig.js +230 -246
- package/lib-next/__tests__/validateThemeConfig.test.js +277 -3
- package/lib-next/admonitions.css +35 -0
- package/lib-next/deps.d.ts +13 -0
- package/lib-next/index.js +45 -13
- 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 +17 -25
- 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/index.js +11 -13
- package/lib-next/theme/BlogSidebar/styles.module.css +2 -2
- package/lib-next/theme/BlogTagsListPage/index.js +14 -55
- package/lib-next/theme/BlogTagsPostsPage/index.js +29 -39
- package/lib-next/theme/CodeBlock/index.js +17 -149
- 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/DocCard/index.js +80 -0
- package/lib-next/theme/DocCard/styles.module.css +43 -0
- package/lib-next/theme/DocCardList/index.js +19 -0
- package/lib-next/theme/DocCategoryGeneratedIndexPage/index.js +49 -0
- package/lib-next/theme/DocCategoryGeneratedIndexPage/styles.module.css +18 -0
- package/lib-next/theme/DocItem/index.js +40 -56
- 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 +46 -47
- package/lib-next/theme/DocPage/styles.module.css +8 -23
- package/lib-next/theme/DocPaginator/index.js +7 -11
- package/lib-next/theme/DocSidebar/index.js +69 -295
- package/lib-next/theme/DocSidebar/styles.module.css +0 -18
- package/lib-next/theme/DocSidebarItem/index.js +217 -0
- package/lib-next/theme/DocSidebarItem/styles.module.css +19 -0
- package/lib-next/theme/DocTagDocListPage/index.js +89 -0
- package/lib-next/theme/DocTagsListPage/index.js +38 -0
- package/lib-next/theme/DocVersionBadge/index.js +27 -0
- package/lib-next/theme/{DocVersionSuggestions → DocVersionBanner}/index.js +51 -36
- package/lib-next/theme/EditThisPage/index.js +6 -1
- package/lib-next/theme/ErrorPageContent.js +35 -0
- package/lib-next/theme/Footer/index.js +27 -5
- package/lib-next/theme/Heading/index.js +25 -29
- package/lib-next/theme/Heading/styles.css +5 -6
- package/lib-next/theme/Heading/styles.module.css +9 -5
- package/lib-next/theme/IconArrow/index.js +2 -2
- package/lib-next/theme/IconClose/index.js +23 -0
- package/lib-next/theme/IconEdit/index.js +2 -2
- package/lib-next/theme/IconExternalLink/index.js +2 -2
- package/lib-next/theme/IconLanguage/index.js +2 -2
- package/lib-next/theme/IconMenu/index.js +2 -2
- package/lib-next/theme/LastUpdated/index.js +3 -2
- package/lib-next/theme/Layout/index.js +3 -1
- package/lib-next/theme/LayoutHead/index.js +18 -23
- package/lib-next/theme/LayoutProviders/index.js +17 -6
- package/lib-next/theme/Logo/index.js +25 -21
- 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 +193 -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 +7 -7
- package/lib-next/theme/NavbarItem/DocsVersionDropdownNavbarItem.js +31 -19
- package/lib-next/theme/NavbarItem/DropdownNavbarItem.js +159 -0
- package/lib-next/theme/NavbarItem/{LocaleDropdownNavbarItem.js → LocaleDropdownNavbarItem/index.js} +4 -12
- package/lib-next/theme/NavbarItem/LocaleDropdownNavbarItem/styles.module.css +11 -0
- package/lib-next/theme/NavbarItem/index.js +25 -12
- package/lib-next/theme/{SearchMetadatas → SearchMetadata}/index.js +1 -1
- package/lib-next/theme/Seo/index.js +11 -7
- package/lib-next/theme/SkipToContent/index.js +7 -8
- 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/ThemeProvider/index.js +10 -7
- package/lib-next/theme/ThemedImage/index.js +7 -8
- package/lib-next/theme/Toggle/index.js +34 -37
- package/lib-next/theme/Toggle/styles.module.css +91 -3
- package/lib-next/theme/UserPreferencesProvider/index.js +9 -10
- 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 +4 -5
- package/lib-next/theme/hooks/useWindowSize.js +34 -20
- package/lib-next/theme/prism-include-languages.js +2 -1
- package/lib-next/theme-classic.d.ts +806 -0
- package/lib-next/translations.js +6 -10
- package/lib-next/types.d.ts +0 -599
- package/lib-next/validateThemeConfig.js +141 -114
- package/package.json +28 -25
- package/src/__tests__/validateThemeConfig.test.js +277 -3
- package/src/admonitions.css +35 -0
- package/src/deps.d.ts +13 -0
- package/src/index.ts +55 -22
- 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 +18 -25
- package/src/theme/BlogPostAuthor/index.tsx +49 -0
- package/src/theme/BlogPostAuthor/styles.module.css +12 -0
- package/src/theme/BlogPostAuthors/index.tsx +39 -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/index.tsx +11 -13
- package/src/theme/BlogSidebar/styles.module.css +2 -2
- package/src/theme/BlogTagsListPage/index.tsx +14 -57
- package/src/theme/BlogTagsPostsPage/index.tsx +29 -39
- package/src/theme/CodeBlock/index.tsx +21 -151
- 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/DocCard/index.tsx +100 -0
- package/src/theme/DocCard/styles.module.css +43 -0
- package/src/theme/DocCardList/index.tsx +27 -0
- package/src/theme/DocCategoryGeneratedIndexPage/index.tsx +53 -0
- package/src/theme/DocCategoryGeneratedIndexPage/styles.module.css +18 -0
- package/src/theme/DocItem/index.tsx +43 -56
- 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 +44 -42
- package/src/theme/DocPage/styles.module.css +8 -23
- package/src/theme/DocPaginator/index.tsx +9 -13
- package/src/theme/DocSidebar/index.tsx +80 -307
- package/src/theme/DocSidebar/styles.module.css +0 -18
- package/src/theme/DocSidebarItem/index.tsx +242 -0
- package/src/theme/DocSidebarItem/styles.module.css +19 -0
- package/src/theme/DocTagDocListPage/index.tsx +89 -0
- package/src/theme/DocTagsListPage/index.tsx +41 -0
- package/src/theme/DocVersionBadge/index.tsx +30 -0
- package/src/theme/{DocVersionSuggestions → DocVersionBanner}/index.tsx +74 -44
- package/src/theme/EditThisPage/index.tsx +6 -1
- package/src/theme/ErrorPageContent.tsx +41 -0
- package/src/theme/Footer/index.tsx +30 -6
- package/src/theme/Heading/index.tsx +25 -31
- package/src/theme/Heading/styles.css +5 -6
- package/src/theme/Heading/styles.module.css +9 -5
- package/src/theme/IconArrow/index.tsx +2 -2
- package/src/theme/IconClose/index.tsx +26 -0
- package/src/theme/IconEdit/index.tsx +2 -2
- package/src/theme/IconExternalLink/index.tsx +2 -5
- package/src/theme/IconLanguage/index.tsx +2 -6
- package/src/theme/IconMenu/index.tsx +3 -3
- package/src/theme/LastUpdated/index.tsx +3 -2
- package/src/theme/Layout/index.tsx +3 -1
- package/src/theme/LayoutHead/index.tsx +18 -17
- package/src/theme/LayoutProviders/index.tsx +17 -6
- package/src/theme/Logo/index.tsx +21 -17
- 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 +203 -61
- package/src/theme/Navbar/styles.module.css +10 -3
- package/src/theme/NavbarItem/DefaultNavbarItem.tsx +42 -154
- package/src/theme/NavbarItem/DocNavbarItem.tsx +12 -16
- package/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx +33 -21
- package/src/theme/NavbarItem/DocsVersionNavbarItem.tsx +7 -3
- package/src/theme/NavbarItem/DropdownNavbarItem.tsx +181 -0
- package/src/theme/NavbarItem/{LocaleDropdownNavbarItem.tsx → LocaleDropdownNavbarItem/index.tsx} +8 -9
- package/src/theme/NavbarItem/LocaleDropdownNavbarItem/styles.module.css +11 -0
- package/src/theme/NavbarItem/index.tsx +41 -16
- package/src/theme/{SearchMetadatas → SearchMetadata}/index.tsx +2 -2
- package/src/theme/Seo/index.tsx +7 -4
- package/src/theme/SkipToContent/index.tsx +7 -8
- 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/ThemeProvider/index.tsx +6 -2
- package/src/theme/ThemedImage/index.tsx +8 -8
- package/src/theme/Toggle/index.tsx +36 -43
- package/src/theme/Toggle/styles.module.css +91 -3
- package/src/theme/UserPreferencesProvider/index.tsx +9 -11
- package/src/theme/hooks/useHideableNavbar.ts +32 -45
- package/src/theme/hooks/useTabGroupChoice.ts +4 -4
- package/src/theme/hooks/useTheme.ts +4 -5
- package/src/theme/hooks/useWindowSize.ts +38 -20
- package/src/theme/prism-include-languages.ts +3 -2
- package/src/theme-classic.d.ts +806 -0
- package/src/translations.ts +8 -10
- package/src/types.d.ts +0 -599
- package/src/{validateThemeConfig.js → validateThemeConfig.ts} +151 -94
- package/tsconfig.json +1 -2
- package/codeTranslations/README.md +0 -20
- package/codeTranslations/ar.json +0 -57
- package/codeTranslations/base.json +0 -112
- package/codeTranslations/bn.json +0 -56
- package/codeTranslations/da.json +0 -57
- package/codeTranslations/de.json +0 -57
- package/codeTranslations/es.json +0 -57
- package/codeTranslations/fa.json +0 -57
- package/codeTranslations/fil.json +0 -57
- package/codeTranslations/fr.json +0 -57
- package/codeTranslations/he.json +0 -57
- package/codeTranslations/hi.json +0 -57
- package/codeTranslations/ja.json +0 -57
- package/codeTranslations/ko.json +0 -57
- package/codeTranslations/pl.json +0 -57
- package/codeTranslations/pt-BR.json +0 -57
- package/codeTranslations/pt-PT.json +0 -57
- package/codeTranslations/ru.json +0 -57
- package/codeTranslations/tr.json +0 -57
- package/codeTranslations/vi.json +0 -57
- package/codeTranslations/zh-Hans.json +0 -57
- package/codeTranslations/zh-Hant.json +0 -57
- package/lib/theme/Toggle/styles.css +0 -103
- package/lib/theme/hooks/useAnnouncementBar.js +0 -63
- package/lib/theme/hooks/useContextualSearchFilters.js +0 -47
- 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/useContextualSearchFilters.js +0 -41
- 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/useContextualSearchFilters.ts +0 -52
- package/src/theme/hooks/useScrollPosition.ts +0 -45
- package/src/theme/hooks/useTOCHighlight.ts +0 -98
- package/update-code-translations.js +0 -239
- package/update-code-translations.test.js +0 -33
|
@@ -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
|
|
|
@@ -26,19 +26,17 @@ export default function BlogSidebar({sidebar}) {
|
|
|
26
26
|
{sidebar.title}
|
|
27
27
|
</div>
|
|
28
28
|
<ul className={styles.sidebarItemList}>
|
|
29
|
-
{sidebar.items.map((item) =>
|
|
30
|
-
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
);
|
|
41
|
-
})}
|
|
29
|
+
{sidebar.items.map((item) => (
|
|
30
|
+
<li key={item.permalink} className={styles.sidebarItem}>
|
|
31
|
+
<Link
|
|
32
|
+
isNavLink
|
|
33
|
+
to={item.permalink}
|
|
34
|
+
className={styles.sidebarItemLink}
|
|
35
|
+
activeClassName={styles.sidebarItemLinkActive}>
|
|
36
|
+
{item.title}
|
|
37
|
+
</Link>
|
|
38
|
+
</li>
|
|
39
|
+
))}
|
|
42
40
|
</ul>
|
|
43
41
|
</nav>
|
|
44
42
|
);
|
|
@@ -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
|
+
searchMetadata={{
|
|
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.
|
|
54
|
-
|
|
52
|
+
pageClassName={ThemeClassNames.page.blogTagPostListPage}
|
|
53
|
+
searchMetadata={{
|
|
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;
|
|
@@ -4,88 +4,22 @@
|
|
|
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
|
-
import React, {useEffect, useState
|
|
7
|
+
import React, {useEffect, useState} from 'react';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
9
|
import Highlight, {defaultProps} from 'prism-react-renderer';
|
|
10
10
|
import copy from 'copy-text-to-clipboard';
|
|
11
|
-
import rangeParser from 'parse-numeric-range';
|
|
12
|
-
import usePrismTheme from '@theme/hooks/usePrismTheme';
|
|
13
11
|
import Translate, {translate} from '@docusaurus/Translate';
|
|
12
|
+
import {
|
|
13
|
+
useThemeConfig,
|
|
14
|
+
parseCodeBlockTitle,
|
|
15
|
+
parseLanguage,
|
|
16
|
+
parseLines,
|
|
17
|
+
} from '@docusaurus/theme-common';
|
|
18
|
+
import usePrismTheme from '@theme/hooks/usePrismTheme';
|
|
14
19
|
import styles from './styles.module.css';
|
|
15
|
-
import {useThemeConfig, parseCodeBlockTitle} from '@docusaurus/theme-common';
|
|
16
|
-
const highlightLinesRangeRegex = /{([\d,-]+)}/;
|
|
17
|
-
|
|
18
|
-
const getHighlightDirectiveRegex = (
|
|
19
|
-
languages = ['js', 'jsBlock', 'jsx', 'python', 'html'],
|
|
20
|
-
) => {
|
|
21
|
-
// supported types of comments
|
|
22
|
-
const comments = {
|
|
23
|
-
js: {
|
|
24
|
-
start: '\\/\\/',
|
|
25
|
-
end: '',
|
|
26
|
-
},
|
|
27
|
-
jsBlock: {
|
|
28
|
-
start: '\\/\\*',
|
|
29
|
-
end: '\\*\\/',
|
|
30
|
-
},
|
|
31
|
-
jsx: {
|
|
32
|
-
start: '\\{\\s*\\/\\*',
|
|
33
|
-
end: '\\*\\/\\s*\\}',
|
|
34
|
-
},
|
|
35
|
-
python: {
|
|
36
|
-
start: '#',
|
|
37
|
-
end: '',
|
|
38
|
-
},
|
|
39
|
-
html: {
|
|
40
|
-
start: '<!--',
|
|
41
|
-
end: '-->',
|
|
42
|
-
},
|
|
43
|
-
}; // supported directives
|
|
44
|
-
|
|
45
|
-
const directives = [
|
|
46
|
-
'highlight-next-line',
|
|
47
|
-
'highlight-start',
|
|
48
|
-
'highlight-end',
|
|
49
|
-
].join('|'); // to be more reliable, the opening and closing comment must match
|
|
50
|
-
|
|
51
|
-
const commentPattern = languages
|
|
52
|
-
.map(
|
|
53
|
-
(lang) =>
|
|
54
|
-
`(?:${comments[lang].start}\\s*(${directives})\\s*${comments[lang].end})`,
|
|
55
|
-
)
|
|
56
|
-
.join('|'); // white space is allowed, but otherwise it should be on it's own line
|
|
57
|
-
|
|
58
|
-
return new RegExp(`^\\s*(?:${commentPattern})\\s*$`);
|
|
59
|
-
}; // select comment styles based on language
|
|
60
|
-
|
|
61
|
-
const highlightDirectiveRegex = (lang) => {
|
|
62
|
-
switch (lang) {
|
|
63
|
-
case 'js':
|
|
64
|
-
case 'javascript':
|
|
65
|
-
case 'ts':
|
|
66
|
-
case 'typescript':
|
|
67
|
-
return getHighlightDirectiveRegex(['js', 'jsBlock']);
|
|
68
|
-
|
|
69
|
-
case 'jsx':
|
|
70
|
-
case 'tsx':
|
|
71
|
-
return getHighlightDirectiveRegex(['js', 'jsBlock', 'jsx']);
|
|
72
|
-
|
|
73
|
-
case 'html':
|
|
74
|
-
return getHighlightDirectiveRegex(['js', 'jsBlock', 'html']);
|
|
75
|
-
|
|
76
|
-
case 'python':
|
|
77
|
-
case 'py':
|
|
78
|
-
return getHighlightDirectiveRegex(['python']);
|
|
79
|
-
|
|
80
|
-
default:
|
|
81
|
-
// all comment types
|
|
82
|
-
return getHighlightDirectiveRegex();
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
|
|
86
20
|
export default function CodeBlock({
|
|
87
21
|
children,
|
|
88
|
-
className:
|
|
22
|
+
className: blockClassName,
|
|
89
23
|
metastring,
|
|
90
24
|
title,
|
|
91
25
|
}) {
|
|
@@ -106,75 +40,11 @@ export default function CodeBlock({
|
|
|
106
40
|
// (note: title="xyz" => title prop still has the quotes)
|
|
107
41
|
|
|
108
42
|
const codeBlockTitle = parseCodeBlockTitle(metastring) || title;
|
|
109
|
-
const button = useRef(null);
|
|
110
|
-
let highlightLines = [];
|
|
111
43
|
const prismTheme = usePrismTheme(); // In case interleaved Markdown (e.g. when using CodeBlock as standalone component).
|
|
112
44
|
|
|
113
45
|
const content = Array.isArray(children) ? children.join('') : children;
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
// Tested above
|
|
117
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
118
|
-
const highlightLinesRange = metastring.match(highlightLinesRangeRegex)[1];
|
|
119
|
-
highlightLines = rangeParser(highlightLinesRange).filter((n) => n > 0);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
let language =
|
|
123
|
-
languageClassName && // Force Prism's language union type to `any` because it does not contain all available languages
|
|
124
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
125
|
-
languageClassName.replace(/language-/, '');
|
|
126
|
-
|
|
127
|
-
if (!language && prism.defaultLanguage) {
|
|
128
|
-
language = prism.defaultLanguage;
|
|
129
|
-
} // only declaration OR directive highlight can be used for a block
|
|
130
|
-
|
|
131
|
-
let code = content.replace(/\n$/, '');
|
|
132
|
-
|
|
133
|
-
if (highlightLines.length === 0 && language !== undefined) {
|
|
134
|
-
let range = '';
|
|
135
|
-
const directiveRegex = highlightDirectiveRegex(language); // go through line by line
|
|
136
|
-
|
|
137
|
-
const lines = content.replace(/\n$/, '').split('\n');
|
|
138
|
-
let blockStart; // loop through lines
|
|
139
|
-
|
|
140
|
-
for (let index = 0; index < lines.length; ) {
|
|
141
|
-
const line = lines[index]; // adjust for 0-index
|
|
142
|
-
|
|
143
|
-
const lineNumber = index + 1;
|
|
144
|
-
const match = line.match(directiveRegex);
|
|
145
|
-
|
|
146
|
-
if (match !== null) {
|
|
147
|
-
const directive = match
|
|
148
|
-
.slice(1)
|
|
149
|
-
.reduce((final, item) => final || item, undefined);
|
|
150
|
-
|
|
151
|
-
switch (directive) {
|
|
152
|
-
case 'highlight-next-line':
|
|
153
|
-
range += `${lineNumber},`;
|
|
154
|
-
break;
|
|
155
|
-
|
|
156
|
-
case 'highlight-start':
|
|
157
|
-
blockStart = lineNumber;
|
|
158
|
-
break;
|
|
159
|
-
|
|
160
|
-
case 'highlight-end':
|
|
161
|
-
range += `${blockStart}-${lineNumber - 1},`;
|
|
162
|
-
break;
|
|
163
|
-
|
|
164
|
-
default:
|
|
165
|
-
break;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
lines.splice(index, 1);
|
|
169
|
-
} else {
|
|
170
|
-
// lines without directives are unchanged
|
|
171
|
-
index += 1;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
highlightLines = rangeParser(range);
|
|
176
|
-
code = lines.join('\n');
|
|
177
|
-
}
|
|
46
|
+
const language = parseLanguage(blockClassName) ?? prism.defaultLanguage;
|
|
47
|
+
const {highlightLines, code} = parseLines(content, metastring, language);
|
|
178
48
|
|
|
179
49
|
const handleCopyCode = () => {
|
|
180
50
|
copy(code);
|
|
@@ -190,7 +60,7 @@ export default function CodeBlock({
|
|
|
190
60
|
code={code}
|
|
191
61
|
language={language}>
|
|
192
62
|
{({className, style, tokens, getLineProps, getTokenProps}) => (
|
|
193
|
-
<div className={styles.codeBlockContainer}>
|
|
63
|
+
<div className={clsx(styles.codeBlockContainer, blockClassName)}>
|
|
194
64
|
{codeBlockTitle && (
|
|
195
65
|
<div style={style} className={styles.codeBlockTitle}>
|
|
196
66
|
{codeBlockTitle}
|
|
@@ -200,14 +70,12 @@ export default function CodeBlock({
|
|
|
200
70
|
<pre
|
|
201
71
|
/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */
|
|
202
72
|
tabIndex={0}
|
|
203
|
-
className={clsx(className, styles.codeBlock, 'thin-scrollbar'
|
|
204
|
-
[styles.codeBlockWithTitle]: codeBlockTitle,
|
|
205
|
-
})}
|
|
73
|
+
className={clsx(className, styles.codeBlock, 'thin-scrollbar')}
|
|
206
74
|
style={style}>
|
|
207
75
|
<code className={styles.codeBlockLines}>
|
|
208
76
|
{tokens.map((line, i) => {
|
|
209
|
-
if (line.length === 1 && line[0].content === '') {
|
|
210
|
-
line[0].content = '
|
|
77
|
+
if (line.length === 1 && line[0].content === '\n') {
|
|
78
|
+
line[0].content = '';
|
|
211
79
|
}
|
|
212
80
|
|
|
213
81
|
const lineProps = getLineProps({
|
|
@@ -215,7 +83,7 @@ export default function CodeBlock({
|
|
|
215
83
|
key: i,
|
|
216
84
|
});
|
|
217
85
|
|
|
218
|
-
if (highlightLines.includes(i
|
|
86
|
+
if (highlightLines.includes(i)) {
|
|
219
87
|
lineProps.className += ' docusaurus-highlight-code-line';
|
|
220
88
|
}
|
|
221
89
|
|
|
@@ -230,6 +98,7 @@ export default function CodeBlock({
|
|
|
230
98
|
})}
|
|
231
99
|
/>
|
|
232
100
|
))}
|
|
101
|
+
<br />
|
|
233
102
|
</span>
|
|
234
103
|
);
|
|
235
104
|
})}
|
|
@@ -237,7 +106,6 @@ export default function CodeBlock({
|
|
|
237
106
|
</pre>
|
|
238
107
|
|
|
239
108
|
<button
|
|
240
|
-
ref={button}
|
|
241
109
|
type="button"
|
|
242
110
|
aria-label={translate({
|
|
243
111
|
id: 'theme.CodeBlock.copyButtonAriaLabel',
|
|
@@ -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
|
+
}
|