Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(v2): improve cli docs #4259

Merged
merged 8 commits into from
Feb 22, 2021
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions packages/docusaurus-theme-classic/codeTranslations/fa.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"theme.NotFound.title": "صفحه‌ای که دنبال آن بودید پیدا نشد!",
"theme.NotFound.p1": "متاسفانه نتوانستیم مطلب مورد نظر شما را پیدا کنیم.",
"theme.NotFound.p2": "لطفا با صاحب وبسایت تماس بگیرید و ایشان را از مشکل پیش آمده مطلع کنید.",
"theme.AnnouncementBar.closeButtonAriaLabel": "بستن",
"theme.blog.paginator.navAriaLabel": "کنترل لیست صفحه وبسایت",
"theme.blog.paginator.newerEntries": "مطالب جدیدتر",
"theme.blog.paginator.olderEntries": "مطالب قدیمی تر",
"theme.blog.post.paginator.navAriaLabel": "کنترل پست های صفحه وبلاگ",
"theme.blog.post.paginator.newerPost": "پست های جدید تر",
"theme.blog.post.paginator.olderPost": "پست های قدیمی تر",
"theme.blog.post.readMore": "ادامه مطلب",
"theme.blog.tags": "برچسب ها:",
"theme.CodeBlock.copyButtonAriaLabel": "کپی کردن کد به کلیپ بورد",
"theme.CodeBlock.copied": "کپی شد",
"theme.CodeBlock.copy": "کپی کردن",
"theme.docs.paginator.navAriaLabel": "کنترل صفحه اسناد",
"theme.docs.paginator.previous": "قبلی",
"theme.docs.paginator.next": "بعدی",
"theme.docs.sidebar.expandButtonTitle": "بزرگ کردن نوار کناری",
"theme.docs.sidebar.expandButtonAriaLabel": "بزرگ کردن نوار کناری",
"theme.docs.sidebar.responsiveCloseButtonLabel": "بستن منو",
"theme.docs.sidebar.responsiveOpenButtonLabel": "باز کردن منو",
"theme.docs.sidebar.collapseButtonTitle": "بستن نوار کناری",
"theme.docs.sidebar.collapseButtonAriaLabel": "بستن نوار کناری",
"theme.common.editThisPage": "ویرایش صفحه",
"theme.common.headingLinkTitle": "لینک مستقیم به عنوان",
"theme.common.skipToMainContent": "رفتن به مطلب اصلی",
"theme.SearchPage.existingResultsTitle": "جستجو برای عبارت",
"theme.SearchPage.emptyResultsTitle": "جستجو در متن",
"theme.SearchPage.inputPlaceholder": "عبارت مورد نظر را اینجا بنویسید",
"theme.SearchPage.inputLabel": "جستجو",
"theme.SearchPage.algoliaLabel": "جستجو با Algolia",
"theme.SearchPage.noResultsText": "هیچ نتیجه ای پیدا نشد",
"theme.SearchPage.fetchingNewResults": "در حال دریافت نتایج...",
"theme.SearchBar.label": "جستجو",
"theme.PwaReloadPopup.info": "نسخه جدیدی منتشر شده است",
"theme.PwaReloadPopup.refreshButtonText": "بروزرسانی",
"theme.PwaReloadPopup.closeButtonAriaLabel": "بستن",
"theme.Playground.liveEditor": "ویرایشگر زنده",
"theme.Playground.result": "نتایج"
}
22 changes: 17 additions & 5 deletions website/docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,18 @@ We highly discourage swizzling of components until we've reached a Beta stage. T

:::

Change any Docusaurus theme components to your liking with `docusaurus swizzle`.
Change any Docusaurus theme components to your liking with `npm run swizzle`.

```shell
docusaurus swizzle [themeName] [componentName] [siteDir]
```bash npm2yarn
npm run swizzle [themeName] [componentName] [siteDir]

# Example (leaving out the siteDir to indicate this directory)
docusaurus swizzle @docusaurus/theme-classic DocSidebar
npm run swizzle @docusaurus/theme-classic DocSidebar
```

Running the command will copy the relevant theme files to your site folder. You may then make any changes to it and Docusaurus will use it instead of the one provided from the theme.

`docusaurus swizzle` without `themeName` lists all the themes available for swizzling similarly `docusaurus swizzle <themeName>` without `componentName` lists all the components available for swizzling.
`npm run swizzle` without `themeName` lists all the themes available for swizzling similarly `npm run swizzle <themeName>` without `componentName` lists all the components available for swizzling.

#### Options

Expand All @@ -114,6 +114,18 @@ Running the command will copy the relevant theme files to your site folder. You
| `--danger` | Allow swizzling of unstable components |
| `--typescript` | Swizzle TypeScript components |

An example to use `--danger` flag let's consider the below code:

```bash npm2yarn
npm run swizzle @docusaurus/theme-classic Logo -- --danger
```

:::caution

Unstable Components: components that have a higher risk of breaking changes due to internal refactorings.

:::

To unswizzle a component, simply delete the files of the swizzled component.

<!--
Expand Down
30 changes: 30 additions & 0 deletions website/docs/guides/docs/docs-markdown-features.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,33 @@ I am referencing a [document](doc1.md). Reference to another [document in a fold
One benefit of this approach is that the links to external files will still work if you are viewing the file on GitHub.

Another benefit, for versioned docs, is that one versioned doc will link to another doc of the exact same version.


## Referencing blog posts

If you want to reference a blog post file, you could use the name of the post you want to reference.

For example, if you are in `folder/doc1.md` and you want to reference `blog/2021-01-02-hello-there.md`:

```md
---
title: Hello There
---
```

You can add a slug to a blog post in its metadata. Consider another blog post named `blog/2021-01-08-bye-everyone.md`:

```md
---
title: Bye Everyone
slug: bye-everyone
---
```

I am referencing a blog post in `../../blog/2021/01/02/hello-there`.

Reference to another blog post with a slug in `../../blog/bye-everyone`.

:::caution Be careful that we should convert the address of the blog post without slug from:

`blog/2021-01-02-hello-there` to `blog/2021/01/02/hello-there` :::
4 changes: 2 additions & 2 deletions website/docs/using-themes.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ Docusaurus Themes' components are designed to be replaceable. To make it easier

To swizzle a component for a theme, run the following command in your doc site:

```shell
docusaurus swizzle <theme name> [component name]
```bash npm2yarn
npm run swizzle <theme name> [component name]
```

As an example, to swizzle the `<Footer />` component in `@docusaurus/theme-classic` for your site, run:
Expand Down