docusaurus/packages/create-docusaurus/templates/shared/docs/tutorial-basics/create-a-document.md

58 lines
1.0 KiB
Markdown
Raw Permalink Normal View History

feat(v2): auto-generated sidebars, frontmatter-less sites (#4582) * POC of autogenerated sidebars * use combine-promises utility lib * autogenerated sidebar poc working * Revert "autogenerated sidebar poc working" This reverts commit c81da980 * POC of auto-generated sidebars for community docs * update tests * add initial test suite for autogenerated sidebars + fix some edge cases * Improve autogen sidebars: strip more number prefixes in folder breadcrumb + slugs * fix typo! * Add tests for partially generated sidebars + fix edge cases + extract sidebar generation code * Ability to read category metadatas file from a file in the category * fix tests * change position of API * ability to extract number prefix * stable system to enable position frontmatter * fix tests for autogen sidebar position * renamings * restore community sidebars * rename frontmatter position -> sidebar_position * make sidebarItemsGenerator fn configurable * minor changes * rename dirPath => dirName * Make the init template use autogenerated sidebars * fix options * fix docusaurus site: remove test docs * add _category_ file to docs pathsToWatch * add _category_ file to docs pathsToWatch * tutorial: use sidebar_position instead of file number prefixes * Adapt Docusaurus tutorial for autogenerated sidebars * remove slug: / * polish the homepage template * rename _category_ sidebar_position to just "position" * test for custom sidebarItemsGenerator fn * fix category metadata + add link to report tutorial issues * fix absolute path breaking tests * fix absolute path breaking tests * Add test for floating number sidebar_position * add sidebarItemsGenerator unit tests * add processSidebars unit tests * Fix init template broken links * windows test * increase code translations test timeout * cleanup mockCategoryMetadataFiles after windows test fixed * update init template positions * fix windows tests * fix comment * Add autogenerated sidebar items documentation + rewrite the full sidebars page doc * add useful comment * fix code block title
2021-04-15 10:20:11 -04:00
---
sidebar_position: 2
---
# Create a Document
Documents are **groups of pages** connected through:
- a **sidebar**
- **previous/next navigation**
- **versioning**
## Create your first Doc
2022-06-15 01:04:33 -04:00
Create a Markdown file at `docs/hello.md`:
feat(v2): auto-generated sidebars, frontmatter-less sites (#4582) * POC of autogenerated sidebars * use combine-promises utility lib * autogenerated sidebar poc working * Revert "autogenerated sidebar poc working" This reverts commit c81da980 * POC of auto-generated sidebars for community docs * update tests * add initial test suite for autogenerated sidebars + fix some edge cases * Improve autogen sidebars: strip more number prefixes in folder breadcrumb + slugs * fix typo! * Add tests for partially generated sidebars + fix edge cases + extract sidebar generation code * Ability to read category metadatas file from a file in the category * fix tests * change position of API * ability to extract number prefix * stable system to enable position frontmatter * fix tests for autogen sidebar position * renamings * restore community sidebars * rename frontmatter position -> sidebar_position * make sidebarItemsGenerator fn configurable * minor changes * rename dirPath => dirName * Make the init template use autogenerated sidebars * fix options * fix docusaurus site: remove test docs * add _category_ file to docs pathsToWatch * add _category_ file to docs pathsToWatch * tutorial: use sidebar_position instead of file number prefixes * Adapt Docusaurus tutorial for autogenerated sidebars * remove slug: / * polish the homepage template * rename _category_ sidebar_position to just "position" * test for custom sidebarItemsGenerator fn * fix category metadata + add link to report tutorial issues * fix absolute path breaking tests * fix absolute path breaking tests * Add test for floating number sidebar_position * add sidebarItemsGenerator unit tests * add processSidebars unit tests * Fix init template broken links * windows test * increase code translations test timeout * cleanup mockCategoryMetadataFiles after windows test fixed * update init template positions * fix windows tests * fix comment * Add autogenerated sidebar items documentation + rewrite the full sidebars page doc * add useful comment * fix code block title
2021-04-15 10:20:11 -04:00
```md title="docs/hello.md"
# Hello
This is my **first Docusaurus document**!
```
A new document is now available at [http://localhost:3000/docs/hello](http://localhost:3000/docs/hello).
feat(v2): auto-generated sidebars, frontmatter-less sites (#4582) * POC of autogenerated sidebars * use combine-promises utility lib * autogenerated sidebar poc working * Revert "autogenerated sidebar poc working" This reverts commit c81da980 * POC of auto-generated sidebars for community docs * update tests * add initial test suite for autogenerated sidebars + fix some edge cases * Improve autogen sidebars: strip more number prefixes in folder breadcrumb + slugs * fix typo! * Add tests for partially generated sidebars + fix edge cases + extract sidebar generation code * Ability to read category metadatas file from a file in the category * fix tests * change position of API * ability to extract number prefix * stable system to enable position frontmatter * fix tests for autogen sidebar position * renamings * restore community sidebars * rename frontmatter position -> sidebar_position * make sidebarItemsGenerator fn configurable * minor changes * rename dirPath => dirName * Make the init template use autogenerated sidebars * fix options * fix docusaurus site: remove test docs * add _category_ file to docs pathsToWatch * add _category_ file to docs pathsToWatch * tutorial: use sidebar_position instead of file number prefixes * Adapt Docusaurus tutorial for autogenerated sidebars * remove slug: / * polish the homepage template * rename _category_ sidebar_position to just "position" * test for custom sidebarItemsGenerator fn * fix category metadata + add link to report tutorial issues * fix absolute path breaking tests * fix absolute path breaking tests * Add test for floating number sidebar_position * add sidebarItemsGenerator unit tests * add processSidebars unit tests * Fix init template broken links * windows test * increase code translations test timeout * cleanup mockCategoryMetadataFiles after windows test fixed * update init template positions * fix windows tests * fix comment * Add autogenerated sidebar items documentation + rewrite the full sidebars page doc * add useful comment * fix code block title
2021-04-15 10:20:11 -04:00
## Configure the Sidebar
Docusaurus automatically **creates a sidebar** from the `docs` folder.
Add metadata to customize the sidebar label and position:
feat(v2): auto-generated sidebars, frontmatter-less sites (#4582) * POC of autogenerated sidebars * use combine-promises utility lib * autogenerated sidebar poc working * Revert "autogenerated sidebar poc working" This reverts commit c81da980 * POC of auto-generated sidebars for community docs * update tests * add initial test suite for autogenerated sidebars + fix some edge cases * Improve autogen sidebars: strip more number prefixes in folder breadcrumb + slugs * fix typo! * Add tests for partially generated sidebars + fix edge cases + extract sidebar generation code * Ability to read category metadatas file from a file in the category * fix tests * change position of API * ability to extract number prefix * stable system to enable position frontmatter * fix tests for autogen sidebar position * renamings * restore community sidebars * rename frontmatter position -> sidebar_position * make sidebarItemsGenerator fn configurable * minor changes * rename dirPath => dirName * Make the init template use autogenerated sidebars * fix options * fix docusaurus site: remove test docs * add _category_ file to docs pathsToWatch * add _category_ file to docs pathsToWatch * tutorial: use sidebar_position instead of file number prefixes * Adapt Docusaurus tutorial for autogenerated sidebars * remove slug: / * polish the homepage template * rename _category_ sidebar_position to just "position" * test for custom sidebarItemsGenerator fn * fix category metadata + add link to report tutorial issues * fix absolute path breaking tests * fix absolute path breaking tests * Add test for floating number sidebar_position * add sidebarItemsGenerator unit tests * add processSidebars unit tests * Fix init template broken links * windows test * increase code translations test timeout * cleanup mockCategoryMetadataFiles after windows test fixed * update init template positions * fix windows tests * fix comment * Add autogenerated sidebar items documentation + rewrite the full sidebars page doc * add useful comment * fix code block title
2021-04-15 10:20:11 -04:00
```md title="docs/hello.md" {1-4}
---
sidebar_label: 'Hi!'
sidebar_position: 3
---
feat(v2): auto-generated sidebars, frontmatter-less sites (#4582) * POC of autogenerated sidebars * use combine-promises utility lib * autogenerated sidebar poc working * Revert "autogenerated sidebar poc working" This reverts commit c81da980 * POC of auto-generated sidebars for community docs * update tests * add initial test suite for autogenerated sidebars + fix some edge cases * Improve autogen sidebars: strip more number prefixes in folder breadcrumb + slugs * fix typo! * Add tests for partially generated sidebars + fix edge cases + extract sidebar generation code * Ability to read category metadatas file from a file in the category * fix tests * change position of API * ability to extract number prefix * stable system to enable position frontmatter * fix tests for autogen sidebar position * renamings * restore community sidebars * rename frontmatter position -> sidebar_position * make sidebarItemsGenerator fn configurable * minor changes * rename dirPath => dirName * Make the init template use autogenerated sidebars * fix options * fix docusaurus site: remove test docs * add _category_ file to docs pathsToWatch * add _category_ file to docs pathsToWatch * tutorial: use sidebar_position instead of file number prefixes * Adapt Docusaurus tutorial for autogenerated sidebars * remove slug: / * polish the homepage template * rename _category_ sidebar_position to just "position" * test for custom sidebarItemsGenerator fn * fix category metadata + add link to report tutorial issues * fix absolute path breaking tests * fix absolute path breaking tests * Add test for floating number sidebar_position * add sidebarItemsGenerator unit tests * add processSidebars unit tests * Fix init template broken links * windows test * increase code translations test timeout * cleanup mockCategoryMetadataFiles after windows test fixed * update init template positions * fix windows tests * fix comment * Add autogenerated sidebar items documentation + rewrite the full sidebars page doc * add useful comment * fix code block title
2021-04-15 10:20:11 -04:00
# Hello
This is my **first Docusaurus document**!
```
It is also possible to create your sidebar explicitly in `sidebars.js`:
```js title="sidebars.js"
export default {
feat(v2): auto-generated sidebars, frontmatter-less sites (#4582) * POC of autogenerated sidebars * use combine-promises utility lib * autogenerated sidebar poc working * Revert "autogenerated sidebar poc working" This reverts commit c81da980 * POC of auto-generated sidebars for community docs * update tests * add initial test suite for autogenerated sidebars + fix some edge cases * Improve autogen sidebars: strip more number prefixes in folder breadcrumb + slugs * fix typo! * Add tests for partially generated sidebars + fix edge cases + extract sidebar generation code * Ability to read category metadatas file from a file in the category * fix tests * change position of API * ability to extract number prefix * stable system to enable position frontmatter * fix tests for autogen sidebar position * renamings * restore community sidebars * rename frontmatter position -> sidebar_position * make sidebarItemsGenerator fn configurable * minor changes * rename dirPath => dirName * Make the init template use autogenerated sidebars * fix options * fix docusaurus site: remove test docs * add _category_ file to docs pathsToWatch * add _category_ file to docs pathsToWatch * tutorial: use sidebar_position instead of file number prefixes * Adapt Docusaurus tutorial for autogenerated sidebars * remove slug: / * polish the homepage template * rename _category_ sidebar_position to just "position" * test for custom sidebarItemsGenerator fn * fix category metadata + add link to report tutorial issues * fix absolute path breaking tests * fix absolute path breaking tests * Add test for floating number sidebar_position * add sidebarItemsGenerator unit tests * add processSidebars unit tests * Fix init template broken links * windows test * increase code translations test timeout * cleanup mockCategoryMetadataFiles after windows test fixed * update init template positions * fix windows tests * fix comment * Add autogenerated sidebar items documentation + rewrite the full sidebars page doc * add useful comment * fix code block title
2021-04-15 10:20:11 -04:00
tutorialSidebar: [
'intro',
// highlight-next-line
'hello',
feat(v2): auto-generated sidebars, frontmatter-less sites (#4582) * POC of autogenerated sidebars * use combine-promises utility lib * autogenerated sidebar poc working * Revert "autogenerated sidebar poc working" This reverts commit c81da980 * POC of auto-generated sidebars for community docs * update tests * add initial test suite for autogenerated sidebars + fix some edge cases * Improve autogen sidebars: strip more number prefixes in folder breadcrumb + slugs * fix typo! * Add tests for partially generated sidebars + fix edge cases + extract sidebar generation code * Ability to read category metadatas file from a file in the category * fix tests * change position of API * ability to extract number prefix * stable system to enable position frontmatter * fix tests for autogen sidebar position * renamings * restore community sidebars * rename frontmatter position -> sidebar_position * make sidebarItemsGenerator fn configurable * minor changes * rename dirPath => dirName * Make the init template use autogenerated sidebars * fix options * fix docusaurus site: remove test docs * add _category_ file to docs pathsToWatch * add _category_ file to docs pathsToWatch * tutorial: use sidebar_position instead of file number prefixes * Adapt Docusaurus tutorial for autogenerated sidebars * remove slug: / * polish the homepage template * rename _category_ sidebar_position to just "position" * test for custom sidebarItemsGenerator fn * fix category metadata + add link to report tutorial issues * fix absolute path breaking tests * fix absolute path breaking tests * Add test for floating number sidebar_position * add sidebarItemsGenerator unit tests * add processSidebars unit tests * Fix init template broken links * windows test * increase code translations test timeout * cleanup mockCategoryMetadataFiles after windows test fixed * update init template positions * fix windows tests * fix comment * Add autogenerated sidebar items documentation + rewrite the full sidebars page doc * add useful comment * fix code block title
2021-04-15 10:20:11 -04:00
{
type: 'category',
label: 'Tutorial',
items: ['tutorial-basics/create-a-document'],
feat(v2): auto-generated sidebars, frontmatter-less sites (#4582) * POC of autogenerated sidebars * use combine-promises utility lib * autogenerated sidebar poc working * Revert "autogenerated sidebar poc working" This reverts commit c81da980 * POC of auto-generated sidebars for community docs * update tests * add initial test suite for autogenerated sidebars + fix some edge cases * Improve autogen sidebars: strip more number prefixes in folder breadcrumb + slugs * fix typo! * Add tests for partially generated sidebars + fix edge cases + extract sidebar generation code * Ability to read category metadatas file from a file in the category * fix tests * change position of API * ability to extract number prefix * stable system to enable position frontmatter * fix tests for autogen sidebar position * renamings * restore community sidebars * rename frontmatter position -> sidebar_position * make sidebarItemsGenerator fn configurable * minor changes * rename dirPath => dirName * Make the init template use autogenerated sidebars * fix options * fix docusaurus site: remove test docs * add _category_ file to docs pathsToWatch * add _category_ file to docs pathsToWatch * tutorial: use sidebar_position instead of file number prefixes * Adapt Docusaurus tutorial for autogenerated sidebars * remove slug: / * polish the homepage template * rename _category_ sidebar_position to just "position" * test for custom sidebarItemsGenerator fn * fix category metadata + add link to report tutorial issues * fix absolute path breaking tests * fix absolute path breaking tests * Add test for floating number sidebar_position * add sidebarItemsGenerator unit tests * add processSidebars unit tests * Fix init template broken links * windows test * increase code translations test timeout * cleanup mockCategoryMetadataFiles after windows test fixed * update init template positions * fix windows tests * fix comment * Add autogenerated sidebar items documentation + rewrite the full sidebars page doc * add useful comment * fix code block title
2021-04-15 10:20:11 -04:00
},
],
};
```