Skip to main content
Star us on GitHubย Star
Version: EOL

๐Ÿง  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โ€‹

YAML inside a note
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.sh only from the main branch.

./deploy.sh --prod

๐Ÿ”— Code inside Tableโ€‹

CommandDescription
lsList files
rmDelete a file
curlMake 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โ€‹

Info Note

Helpful message here. Here's inline code.

console.log("Note block");
Pro Tip

Use tips for helpful suggestions!

echo "Tips are useful"
Information

Extra information provided here.

{ "info": true }
Caution

Something might go wrong!

raise Warning("Caution advised")
Danger Zone

Things can break here. Proceed with care.

rm -rf /
Warning

Not quite danger, but definitely not safe.

warning: true
Pay Attention

Critical information ahead!

type Important = "Very";

๐Ÿ” Expandable Contentโ€‹

Click to expand

Inside the details blockโ€‹

echo "Inside details"
note
echo "Inside admonition, inside details"

โœ… 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>