๐ง Complex Markdown Code Example
This doc demonstrates inline code, fenced blocks, syntax highlighting, code inside lists, blockquotes, and nested content.
๐ก Inline & Blockโ
Use npm run build to generate the static files.
# Install dependencies
npm install
# Build the site
npm run build
๐ฆ JSON Configโ
{
"title": "Example",
"version": "1.0.0",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
}
}
๐งฑ Inside Admonitionโ
site:
name: MySite
theme: dark
plugins:
- search
- analytics
๐ Lists with Codeโ
- Install with
yarn - Build with
npm run build - Run a local server:
npx serve dist
๐งฉ Mixed Contentโ
โ Run
./deploy.shonly from themainbranch../deploy.sh --prod
๐ Code inside Tableโ
| Command | Description |
|---|---|
ls | List files |
rm | Delete a file |
curl | Make HTTP requests |
๐งช Button-style (via HTML)โ
Use raw HTML for buttons:
<button onclick="alert('Hello!')">Click Me</button>
๐งฌ Complex Functionโ
function debounce<F extends (...args: any[]) => void>(fn: F, delay = 300): F {
let timeout: ReturnType<typeof setTimeout>;
return function(this: any, ...args: any[]) {
clearTimeout(timeout);
timeout = setTimeout(() => fn.apply(this, args), delay);
} as F;
}
Demonstrates every admonition, <details>, inline HTML, code blocks, and embedded buttons.
๐ All Admonitions with Buttons and Codeโ
Helpful message here. Here's inline code.
console.log("Note block");
Use tips for helpful suggestions!
echo "Tips are useful"
Extra information provided here.
{ "info": true }
Something might go wrong!
raise Warning("Caution advised")
Things can break here. Proceed with care.
rm -rf /
Not quite danger, but definitely not safe.
warning: true
Critical information ahead!
type Important = "Very";
๐ Expandable Contentโ
Click to expand
โ Confirmed Featuresโ
- Admonitions
- Code blocks
- Inline code
- HTML buttons
-
<details>block
Import GitHub Markdownโ
You can import Markdown from other repositories, e.g., README.md, by adding the Git remote to gendoc.sh, then importing the Markdown with the import component from the correlated path within the remotes directory.
import SomeMd from '/docs/remotes/some-remote/README.md';
<SomeMd />
See GitHub Markdown admonition examples in the Code Block Formatting Demo
When to Use the MarkdownWithoutH1 Component with Imported Markdownโ
When importing GitHub Markdown as MDX, you have two choices for the H1 page title: use the title from the imported Markdown or set an alternative title.
Typically, setting any title in Docsaurus will display both, even if title is not set in the front matter, because the default title is the page name.
To use the imported title, set hide_title: true in front matter to hide the Docusaurus title.
---
hide_title: true
---
import SomeMd from '/docs/remotes/some-remote/README.md';
<SomeMd />
To hide the imported title and use the Docusaurus title, set hide_title: false, title: My Alt Title, and enclose the imported Markdown with <MarkdownWithoutH1>.
---
title: A Descriptive Title
---
import SomeMd from '/docs/remotes/some-remote/README.md';
import MarkdownWithoutH1 from '@site/src/components/MarkdownWithoutH1';
<MarkdownWithoutH1>
<SomeMd />
</MarkdownWithoutH1>