Skip to main content

Hacks

Disclaimer

This page contains various hacks and tips for using Docusaurus effectively (as used in the current documentation). Use these hacks to enhance your documentation and make it more engaging for your readers. Please note that these hacks are not official features of Docusaurus and may not be supported in future versions. Use them at your own risk!

Use these hacks in docusaurus

Code

1. Show line numbers in code blocks

Use the showLineNumbers option in your code blocks to display line numbers. For example:

```js showLineNumbers
// Example of a Docusaurus hack
console.log("This is a Docusaurus hack!");
 ```
// Example of a Docusaurus hack
console.log("This is a Docusaurus hack!");
// Example of a Rust hack
fn main() {
println!("This is a Rust hack!");
}

2. Create tabs in your documentation

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

Use the above imports to create tabs in your Docusaurus documentation. For example:

<Tabs>
<TabItem value="apple" label="Apple">This is an apple 🍎</TabItem>
<TabItem value="orange" label="Orange">This is an orange 🍊</TabItem>
<TabItem value="banana" label="Banana">This is a banana 🍌</TabItem>
</Tabs>
This is an apple 🍎