From 6a772828c590bc52f63c45daf6b98585db1abd1b Mon Sep 17 00:00:00 2001 From: Joshua Chen Date: Tue, 28 Dec 2021 15:19:23 +0800 Subject: [PATCH] docs: add default value for BrowserWindow URL field (#6207) * docs: fix BrowserWindow URL field * fix --- .../_pages tests/code-block-tests.mdx | 6 +-- website/_dogfooding/_pages tests/index.md | 10 ++++ .../_pages tests/markdownPageTests.md | 4 +- website/docs/guides/docs/docs-create-doc.mdx | 2 +- .../markdown-features-admonitions.mdx | 51 ++++++++++++------- .../markdown-features-react.mdx | 6 +-- .../src/components/BrowserWindow/index.tsx | 6 ++- 7 files changed, 56 insertions(+), 29 deletions(-) diff --git a/website/_dogfooding/_pages tests/code-block-tests.mdx b/website/_dogfooding/_pages tests/code-block-tests.mdx index a7219bf529..6cf9ee67f6 100644 --- a/website/_dogfooding/_pages tests/code-block-tests.mdx +++ b/website/_dogfooding/_pages tests/code-block-tests.mdx @@ -33,7 +33,7 @@ Multi-line text inside `pre` will turn into one-liner, but it's okay (https://gi ### `pre > element`
-  Lol bro
+  Lol bro
 
### `pre > element[]` @@ -78,7 +78,7 @@ Multi-line text inside `pre` will turn into one-liner, but it's okay (https://gi ### `code > element` - Lol bro + Lol bro ### `code > element[]` @@ -118,7 +118,7 @@ Multi-line text inside `pre` will turn into one-liner, but it's okay (https://gi ### `CodeBlock > element` - Lol bro + Lol bro ### `CodeBlock > element[]` diff --git a/website/_dogfooding/_pages tests/index.md b/website/_dogfooding/_pages tests/index.md index 1924033718..6218047350 100644 --- a/website/_dogfooding/_pages tests/index.md +++ b/website/_dogfooding/_pages tests/index.md @@ -17,3 +17,13 @@ import Readme from "../README.md" ``` + +### Other tests + +- [Code block tests](/tests/pages/code-block-tests) +- [Error boundary tests](/tests/pages/error-boundary-tests) +- [Hydration tests](/tests/pages/hydration-tests) +- [Asset linking tests](/tests/pages/markdown-tests) +- [General Markdown tests](/tests/pages/markdownPageTests) +- [TOC tests](/tests/pages/page-toc-tests) +- [Tabs tests](/tests/pages/tabs-tests) diff --git a/website/_dogfooding/_pages tests/markdownPageTests.md b/website/_dogfooding/_pages tests/markdownPageTests.md index 3db7deb697..2f7ecdcb8f 100644 --- a/website/_dogfooding/_pages tests/markdownPageTests.md +++ b/website/_dogfooding/_pages tests/markdownPageTests.md @@ -72,7 +72,7 @@ import MyComponent from './myComponent'; ; ``` - + @@ -92,7 +92,7 @@ import CodeBlock from "@theme/CodeBlock" import MyComponentSource from '!!raw-loader!@site/src/pages/examples/\_myComponent'; - + {MyComponentSource} diff --git a/website/docs/guides/docs/docs-create-doc.mdx b/website/docs/guides/docs/docs-create-doc.mdx index 90a7b70df7..8443a6fbbf 100644 --- a/website/docs/guides/docs/docs-create-doc.mdx +++ b/website/docs/guides/docs/docs-create-doc.mdx @@ -57,7 +57,7 @@ This will render in the browser as follows: ```mdx-code-block import BrowserWindow from '@site/src/components/BrowserWindow'; - +

Hello from Docusaurus

diff --git a/website/docs/guides/markdown-features/markdown-features-admonitions.mdx b/website/docs/guides/markdown-features/markdown-features-admonitions.mdx index 191ae48fbb..82e307b653 100644 --- a/website/docs/guides/markdown-features/markdown-features-admonitions.mdx +++ b/website/docs/guides/markdown-features/markdown-features-admonitions.mdx @@ -5,39 +5,45 @@ description: Handling admonitions/callouts in Docusaurus Markdown slug: /markdown-features/admonitions --- +import BrowserWindow from '@site/src/components/BrowserWindow'; + In addition to the basic Markdown syntax, we use [remark-admonitions](https://github.com/elviswolcott/remark-admonitions) alongside MDX to add support for admonitions. Admonitions are wrapped by a set of 3 colons. Example: - :::note +```md +:::note - Some **content** with _markdown_ `syntax`. Check [this `api`](#). +Some **content** with _markdown_ `syntax`. Check [this `api`](#). - ::: +::: - :::tip +:::tip - Some **content** with _markdown_ `syntax`. Check [this `api`](#). +Some **content** with _markdown_ `syntax`. Check [this `api`](#). - ::: +::: - :::info +:::info - Some **content** with _markdown_ `syntax`. Check [this `api`](#). +Some **content** with _markdown_ `syntax`. Check [this `api`](#). - ::: +::: - :::caution +:::caution - Some **content** with _markdown_ `syntax`. Check [this `api`](#). +Some **content** with _markdown_ `syntax`. Check [this `api`](#). - ::: +::: - :::danger +:::danger - Some **content** with _markdown_ `syntax`. Check [this `api`](#). +Some **content** with _markdown_ `syntax`. Check [this `api`](#). - ::: +::: +``` + + :::note @@ -69,6 +75,8 @@ Some **content** with _markdown_ `syntax`. Check [this `api`](#). ::: + + ## Usage with Prettier {#usage-with-prettier} If you use [Prettier](https://prettier.io) to format your Markdown files, Prettier might autoformat your code to invalid admonition syntax. To avoid this problem, add empty lines around the starting and ending directives. This is also why the examples we show here all have empty lines around the content. @@ -95,11 +103,15 @@ Hello world You may also specify an optional title - :::note Your Title +```md +:::note Your Title - Some **content** with _markdown_ `syntax`. +Some **content** with _markdown_ `syntax`. - ::: +::: +``` + + :::note Your Title @@ -107,6 +119,8 @@ Some **content** with _markdown_ `syntax`. ::: + + ## Admonitions with MDX You can use MDX inside admonitions too! @@ -175,7 +189,6 @@ The types that are accepted are the same as above: `note`, `tip`, `danger`, `inf ```mdx-code-block import Admonition from '@theme/Admonition'; -import BrowserWindow from '@site/src/components/BrowserWindow'; diff --git a/website/docs/guides/markdown-features/markdown-features-react.mdx b/website/docs/guides/markdown-features/markdown-features-react.mdx index 6096ffed99..4fcc5ae9ff 100644 --- a/website/docs/guides/markdown-features/markdown-features-react.mdx +++ b/website/docs/guides/markdown-features/markdown-features-react.mdx @@ -64,7 +64,7 @@ export const Highlight = ({children, color}) => ( ); - + Docusaurus green {` `}and Facebook blue are my favorite colors. @@ -107,7 +107,7 @@ import MyComponentSource from '!!raw-loader!./myComponent'; import CodeBlock from '@theme/CodeBlock'; import MyComponentSource from '!!raw-loader!@site/src/pages/examples/_myComponent'; - + {MyComponentSource} @@ -157,7 +157,7 @@ import PartialExample from './_markdown-partial-example.mdx'; ```mdx-code-block import PartialExample from './_markdown-partial-example.mdx'; - + diff --git a/website/src/components/BrowserWindow/index.tsx b/website/src/components/BrowserWindow/index.tsx index d3aa773844..67df5f9d9a 100644 --- a/website/src/components/BrowserWindow/index.tsx +++ b/website/src/components/BrowserWindow/index.tsx @@ -15,7 +15,11 @@ interface Props { url: string; } -function BrowserWindow({children, minHeight, url}: Props): JSX.Element { +function BrowserWindow({ + children, + minHeight, + url = 'http://localhost:3000', +}: Props): JSX.Element { return (