-
-
Notifications
You must be signed in to change notification settings - Fork 437
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #911 from Cysharp/feature/DocsAdditionalInfo
Add additional information to the top of pages
- Loading branch information
Showing
9 changed files
with
95 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from 'react'; | ||
|
||
import LastUpdated from '@theme/LastUpdated'; | ||
import {useDoc} from '@docusaurus/plugin-content-docs/client' | ||
|
||
export default function AdditionalHeaderMetaRow(props: { children: React.ReactNode }) { | ||
const {metadata} = useDoc(); | ||
|
||
return ( | ||
<> | ||
<LastUpdated lastUpdatedAt={metadata.lastUpdatedAt} /> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import {visit} from 'unist-util-visit'; | ||
|
||
const plugin = (options) => { | ||
const transformer = async (ast) => { | ||
visit(ast, 'heading', (node, index, parent) => { | ||
if (node.depth === 1 && node.children.length > 0) { | ||
parent.children.push({ | ||
type: 'containerDirective', | ||
data: { | ||
hName: 'AdditionalHeaderMetaRow', | ||
hProperties: {} | ||
} | ||
}); | ||
} | ||
}); | ||
}; | ||
return transformer; | ||
}; | ||
|
||
export default plugin; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import MDXComponents from '@theme-original/MDXComponents'; | ||
import AdditionalHeaderMetaRow from '@site/src/components/AdditionalHeaderMetaRow'; | ||
|
||
export default { | ||
...MDXComponents, | ||
AdditionalHeaderMetaRow, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React, {type ReactNode} from 'react'; | ||
import clsx from 'clsx'; | ||
import MDXContent from '@theme-original/MDXContent'; | ||
import type MDXContentType from '@theme/MDXContent'; | ||
import type {WrapperProps} from '@docusaurus/types'; | ||
import styles from './styles.module.css'; | ||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; | ||
|
||
type Props = WrapperProps<typeof MDXContentType>; | ||
|
||
export default function MDXContentWrapper(props: Props): ReactNode { | ||
const {i18n} = useDocusaurusContext(); | ||
return ( | ||
<> | ||
{(i18n.currentLocale != 'ja' && i18n.currentLocale != 'en') && | ||
<div className={clsx(styles.communityNotice, "alert alert--secondary")}> | ||
Translation of pages other than English and Japanese versions is maintained by community contributions. | ||
The project does not guarantee the accuracy of the content and may not reflect the latest content. | ||
</div> | ||
} | ||
<MDXContent {...props} /> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.communityNotice { | ||
font-size: 0.9rem; | ||
margin-bottom: 0.8rem; | ||
} |