๐ฆ plugin-content-docs
Provides the Docs functionality and is the default docs plugin for Docusaurus.
Installationโ
- npm
- Yarn
- pnpm
npm install --save @docusaurus/plugin-content-docs
yarn add @docusaurus/plugin-content-docs
pnpm add @docusaurus/plugin-content-docs
ํ
If you use the preset @docusaurus/preset-classic
, you don't need to install this plugin as a dependency.
You can configure this plugin through the preset options.
Configurationโ
์ค์ ํ ์ ์๋ ํ๋
์ต์ ๋ช | ํ์ | ๊ธฐ๋ณธ๊ฐ | ์ค๋ช |
---|---|---|---|
path | string | 'docs' | ์ฌ์ดํธ ๋๋ ํ ๋ฆฌ์ ์๋์ ์ธ ํ์ผ ์์คํ ์ ๋ฌธ์ ์ฝํ ์ธ ๋๋ ํ ๋ฆฌ ๊ฒฝ๋ก์ ๋๋ค. |
editUrl | string | EditUrlFunction | undefined | ์ฌ์ดํธ๋ฅผ ํธ์งํ๊ธฐ ์ํ Base URL์
๋๋ค. The final URL is computed by editUrl + relativeDocPath . ์ต์
์ฌ์ฉ ์ ๊ฐ ํ์ผ์ ๋ํ ์ธ๋ฐํ ์ ์ด๋ฅผ ํ ์ ์์ต๋๋ค. ํด๋น ํ๋๋ฅผ ์ค์ ํ์ง ์์ผ๋ฉด ํธ์ง ๋งํฌ๊ฐ ๋นํ์ฑํ๋ฉ๋๋ค. |
editLocalizedFiles | boolean | false | ํธ์ง URL์ ํ์งํ๋์ง ์์ ์๋ณธ ํ์ผ ๋์ ํ์งํ๋ ํ์ผ์ ๋์์ผ๋ก ํฉ๋๋ค. Ignored when editUrl is a function. |
editCurrentVersion | boolean | false | ํธ์ง URL์ ํญ์ ์ด์ ๋ฒ์ ๋์ ํ์ฌ ๋ฒ์ ๋ฌธ์๋ฅผ ๋์์ผ๋ก ํฉ๋๋ค. Ignored when editUrl is a function. |
routeBasePath | string | 'docs' | ์ฌ์ดํธ ๋ฌธ์ ์น์
์ ๋ํ URL ๋ผ์ฐํธ DO NOT include a trailing slash. Use / for shipping docs without base path. |
tagsBasePath | string | 'tags' | ์ฌ์ดํธ ํ๊ทธ ๋ชฉ๋ก ํ์ด์ง์ ๋ํ URL ๋ผ์ฐํธ It is prepended to the routeBasePath . |
include | string[] | ['**/*.{md,mdx}'] | ์ฝํ ์ธ ๊ฒฝ๋ก๋ฅผ ๊ธฐ์ค์ผ๋ก ๋น๋ํ ๋งํฌ๋ค์ด ํ์ผ๊ณผ ์ผ์นํ๋ glob ํจํด ๋ฐฐ์ด์ ๋๋ค. |
exclude | string[] | See example configuration | ์ ์ธํ ๋งํฌ๋ค์ด ํ์ผ๊ณผ ์ผ์นํ๋ glob ํจํด ๋ฐฐ์ด์
๋๋ค. Serves as refinement based on the include option. |
sidebarPath | false | string | undefined | ์ฌ์ด๋๋ฐ ๊ตฌ์ฑ ๊ฒฝ๋ก์
๋๋ค. Use false to disable sidebars, or undefined to create a fully autogenerated sidebar. |
sidebarCollapsible | boolean | true | ๊ธฐ๋ณธ์ ์ผ๋ก ์ฌ์ด๋๋ฐ ์นดํ ๊ณ ๋ฆฌ๋ฅผ ์ ์ ์ ์๋์ง ์ฌ๋ถ๋ฅผ ์ค์ ํฉ๋๋ค. See also Collapsible categories |
sidebarCollapsed | boolean | true | ๊ธฐ๋ณธ์ ์ผ๋ก ์ฌ์ด๋๋ฐ ์นดํ ๊ณ ๋ฆฌ๋ฅผ ์ ์์ง ์ฌ๋ถ๋ฅผ ์ค์ ํฉ๋๋ค. See also Expanded categories by default |
sidebarItemsGenerator | SidebarGenerator | Omitted | Function used to replace the sidebar items of type 'autogenerated' with real sidebar items (docs, categories, links...). See also Customize the sidebar items generator |
numberPrefixParser | boolean | PrefixParser | Omitted | ํ์ผ๋ช
์์ ์ซ์ ์ ๋์ฌ๋ฅผ ์ถ์ถํ๋ ์ฌ์ฉ์ ์ง์ ๊ตฌ๋ฌธ ๋ถ์ ๋ฐฉ์์ ์ค์ ํฉ๋๋ค. Use false to disable this behavior and leave the docs untouched, and true to use the default parser. See also Using number prefixes |
docsRootComponent | string | '@theme/DocsRoot' | ๋ชจ๋ ๋ฌธ์ ํ๋ฌ๊ทธ์ธ ํ์ด์ง(๋ชจ๋ ๋ฒ์ ํฌํจ)์ ์์ ์ปดํฌ๋ํธ์ ๋๋ค. ๋ฌธ์ ํ์ด ์ง์ ๋ฒ์ ์ฌ์ด๋ฅผ ํ์ํ ๋ ๋ง์ดํธ๋ ์ํ๋ก ์ ์ง๋ฉ๋๋ค. |
docVersionRootComponent | string | '@theme/DocVersionLayout' | ๊ฐ๋ณ ๋ฒ์ ์ ๋ชจ๋ ๋ฌธ์ ํ์ด์ง(์ฌ์ด๋๋ฐ๊ฐ ์๋ ๋ฌธ์ ํ์ด์ง, ํ๊ทธ ํ์ด์ง)์ ์์ ์ปดํฌ๋ํธ์ ๋๋ค. ํน์ ๋ฒ์ ์ ํ์ด์ง ์ฌ์ด๋ฅผ ํ์ํ ๋ ๋ง์ดํธ๋ ์ํ๋ก ์ ์ง๋ฉ๋๋ค. |
docRootComponent | string | '@theme/DocPage' | ์ฌ์ด๋๋ฐ๊ฐ ์๋ ๋ชจ๋ ๋ฌธ์ ํ์ด์ง(์ผ๋ฐ ๋ฌธ์ ํ์ด์ง, ์นดํ ๊ณ ๋ฆฌ ์์ฑ ์์ธ ํ์ด์ง)์ ์์ ์ปดํฌ๋ํธ์ ๋๋ค. ๊ฐ ํ์ด์ง ์ฌ์ด๋ฅผ ํ์ํ ๋ ๋ง์ดํธ๋ ์ํ๋ก ์ ์ง๋ฉ๋๋ค. |
docItemComponent | string | '@theme/DocItem' | ๋ชฉ์ฐจ, ํ์ด์ง ์์ญ ๋ฑ ๊ธฐ๋ณธ ๋ฌธ์ ์ปจํ ์ด๋ |
docTagsListComponent | string | '@theme/DocTagsListPage' | ํ๊ทธ ๋ชฉ๋ก ํ์ด์ง์ ๋ฃจํธ ์ปดํฌ๋ํธ |
docTagDocListComponent | string | '@theme/DocTagDocListPage' | "ํ๊ทธ X๋ฅผ ํฌํจํ ๋ฌธ์" ํ์ด์ง์ ๋ฃจํธ ์ปดํฌ๋ํธ |
docCategoryGeneratedIndexComponent | string | '@theme/DocCategoryGeneratedIndexPage' | ์์ฑ๋ ์นดํ ๊ณ ๋ฆฌ ์ธ๋ฑ์ค ํ์ด์ง์ ๋ฃจํธ ์ปดํฌ๋ํธ |
remarkPlugins | any[] | [] | MDX์ ์ ๋ฌ๋ Remark ํ๋ฌ ๊ทธ์ธ |
rehypePlugins | any[] | [] | MDX์ ์ ๋ฌ๋ Rehype ํ๋ฌ๊ทธ์ธ |
beforeDefaultRemarkPlugins | any[] | [] | ๊ธฐ๋ณธ ๋ํ์ฌ์ฐ๋ฃจ์ค Remark ํ๋ฌ๊ทธ์ธ๋ณด๋ค ๋จผ์ MDX์ ์ ๋ฌ๋ ์ฌ์ฉ์ ์ง์ Remark ํ๋ฌ๊ทธ์ธ |
beforeDefaultRehypePlugins | any[] | [] | ๊ธฐ๋ณธ ๋ํ์ฌ์ฐ๋ฃจ์ค Rehype ํ๋ฌ๊ทธ์ธ๋ณด๋ค ๋จผ์ MDX์ ์ ๋ฌ๋ ์ฌ์ฉ์ ์ง์ Rehype ํ๋ฌ๊ทธ์ธ |
showLastUpdateAuthor | boolean | false | ๋ฌธ์๋ฅผ ๋ง์ง๋ง์ผ๋ก ์ ๋ฐ์ดํธํ ์์ฑ์๋ฅผ ํ์ํ ์ง ์ฌ๋ถ |
showLastUpdateTime | boolean | false | Whether to display the last date the doc was updated. This requires access to git history during the build, so will not work correctly with shallow clones (a common default for CI systems). |
breadcrumbs | boolean | true | ๋ฌธ์ ํ์ด์ง์์ ์ด๋ ๊ฒฝ๋ก๋ฅผ ํ์ฑํ ๋๋ ๋นํ์ฑํ |
disableVersioning | boolean | false | ์ฌ๋ฌ ๋ฒ์ ์ด ์๋๋ผ๋ ๋ช
์์ ์ผ๋ก ๋ฒ์ ๊ด๋ฆฌ๋ฅผ ๋นํ์ฑํํฉ๋๋ค. ์ด๋ ๊ฒ ํ๋ฉด ์ฌ์ดํธ์ ํ์ฌ ๋ฒ์ ๋ง ํฌํจ๋ฉ๋๋ค. Will error if includeCurrentVersion: false and disableVersioning: true . |
includeCurrentVersion | boolean | true | ๋ฌธ์์ ํ์ฌ ๋ฒ์ ์ ํฌํจ |
lastVersion | string | First version in versions.json | ๋ฌธ์ ๋ฉ๋ด๋ฐ ์์ดํ ์ ๋ํด ์ฐ์ ์ ์ผ๋ก ํ์๋๊ณ ๊ธฐ๋ณธ์ ์ผ๋ก ํ์๋๋ ๋ฒ์ |
onlyIncludeVersions | string[] | ์ฌ์ฉํ ์ ์๋ ๋ชจ๋ ๋ฒ์ | ์ฌ์ฉํ ์ ์๋ ๋ชจ๋ ๋ฒ์ ์ ํ์ ์งํฉ๋ง ํฌํจ |
versions | VersionsConfig | {} | ๊ฐ ๋ฒ์ ์ ์์ฑ์ ๋ ๋ฆฝ์ ์ผ๋ก ์ฌ์ฉ์ ์ง์ ํฉ๋๋ค. |
Typesโ
EditUrlFunction
โ
type EditUrlFunction = (params: {
version: string;
versionDocsDirPath: string;
docPath: string;
permalink: string;
locale: string;
}) => string | undefined;
PrefixParser
โ
type PrefixParser = (filename: string) => {
filename: string;
numberPrefix?: number;
};
SidebarGenerator
โ
type SidebarGenerator = (generatorArgs: {
/** The sidebar item with type "autogenerated" to be transformed. */
item: {type: 'autogenerated'; dirName: string};
/** Useful metadata for the version this sidebar belongs to. */
version: {contentPath: string; versionName: string};
/** All the docs of that version (unfiltered). */
docs: {
id: string;
title: string;
frontMatter: DocFrontMatter & Record<string, unknown>;
source: string;
sourceDirName: string;
sidebarPosition?: number | undefined;
}[];
/** Number prefix parser configured for this plugin. */
numberPrefixParser: PrefixParser;
/** The default category index matcher which you can override. */
isCategoryIndex: CategoryIndexMatcher;
/**
* key is the path relative to the doc content directory, value is the
* category metadata file's content.
*/
categoriesMetadata: {[filePath: string]: CategoryMetadata};
/**
* Useful to re-use/enhance the default sidebar generation logic from
* Docusaurus.
*/
defaultSidebarItemsGenerator: SidebarGenerator;
// Returns an array of sidebar items โ same as what you can declare in
// sidebars.js, except for shorthands. See https://docusaurus.io/docs/sidebar/items
}) => Promise<SidebarItem[]>;
type CategoryIndexMatcher = (param: {
/** The file name, without extension */
fileName: string;
/**
* The list of directories, from lowest level to highest.
* If there's no dir name, directories is ['.']
*/
directories: string[];
/** The extension, with a leading dot */
extension: string;
}) => boolean;
VersionsConfig
โ
type VersionConfig = {
/**
* The base path of the version, will be appended to `baseUrl` +
* `routeBasePath`.
*/
path?: string;
/** The label of the version to be used in badges, dropdowns, etc. */
label?: string;
/** The banner to show at the top of a doc of that version. */
banner?: 'none' | 'unreleased' | 'unmaintained';
/** Show a badge with the version label at the top of each doc. */
badge?: boolean;
/** Prevents search engines from indexing this version */
noIndex?: boolean;
/** Add a custom class name to the <html> element of each doc */
className?: string;
};
type VersionsConfig = {[versionName: string]: VersionConfig};