--- title: Markdown Page example title description: Markdown Page example description wrapperClassName: docusaurus-markdown-example --- # Markdown page This is a page generated from markdown to illustrate the Markdown page feature. It supports all the regular MDX features, as you can see: :::info Useful information. ::: ```jsx live function Button() { return ( ); } ``` ### Using absolute path ![](/img/docusaurus.png) import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; This is an apple 🍎This is an orange 🍊This is a banana 🍌 ## Import Mdx and Md files ```js // *.md file import Chapter1 from './_chapter1.md'; ; // *.mdx file import Chapter2 from './_chapter2.mdx'; ; ``` import Chapter1 from './\_chapter1.md'; import Chapter2 from './\_chapter2.mdx'; ## Comments MDX comments can be used with ```mdx ``` See, nothing is displayed: ## Import code block from source code file import MyComponent from "@site/src/pages/examples/\_myComponent" import BrowserWindow from '@site/src/components/BrowserWindow'; Let's say you have a React component. You can import and use it in MDX: ```jsx title="myMarkdownFile.mdx" import MyComponent from './myComponent'; ; ``` But you can also display its source code directly in MDX, thanks to [Webpack raw-loader](https://webpack.js.org/loaders/raw-loader/) ```jsx title="myMarkdownFile.mdx" import CodeBlock from '@theme/CodeBlock'; import MyComponentSource from '!!raw-loader!./myComponent'; {MyComponentSource}; ``` import CodeBlock from "@theme/CodeBlock" import MyComponentSource from '!!raw-loader!@site/src/pages/examples/\_myComponent'; {MyComponentSource} ## Test ```jsx live function Demo() { React.useEffect(() => console.log('mount'), []); return null; } ``` ## Code block test ```js title="Title" function Clock(props) { const [date, setDate] = useState(new Date()); useEffect(() => { var timerID = setInterval(() => tick(), 1000); return function cleanup() { clearInterval(timerID); }; }); function tick() { setDate(new Date()); } return (

It is {date.toLocaleTimeString()}.

// highlight-start {/* prettier-ignore */} long long long long long long long long long long long long line {/* prettier-ignore */} // highlight-end
); } ``` ```jsx live function Clock(props) { const [date, setDate] = useState(new Date()); useEffect(() => { var timerID = setInterval(() => tick(), 1000); return function cleanup() { clearInterval(timerID); }; }); function tick() { setDate(new Date()); } return (

It is {date.toLocaleTimeString()}.

); } ``` test test