After searching extensively, I discovered that formatted code can be added within another tag called CodeBlock and imported. Finally, the code appears as follows:
```mdx-code-block
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import CodeBlock from '@theme/CodeBlock';
```
<mdx-code-block>
<Tabs>
<TabItem value="current" label="Current">
<CodeBlock language="php">
{`$event = request()->event;
$causerName = request()->causerName;
$causerLastName = request()->causerLastName;
$action = request()->action;
$role = request()->role;
$initDate = request()->initDate;
$finDate = request()->finDate;
`}
</CodeBlock>
</TabItem>
I hope this helps you.
Answer from dcandamil on Stack OverflowDocusaurus
docusaurus.io › guides › markdown features › code blocks
Code blocks | Docusaurus
July 10, 2026 - You will also need to add the plugin to your docusaurus.config.js. ... To use the plugin, create a code block with live attached to the language meta string.
Starred by 32 users
Forked by 5 users
Languages: TypeScript 64.8% | JavaScript 29.0% | CSS 6.2%
» npm install @docusaurus/theme-live-codeblock
Published: Apr 07, 2026
Version: 3.10.0
CloudCannon
cloudcannon.com › documentation › articles › snippets-using-docusaurus-components
Snippets using Docusaurus Components | CloudCannon Documentation
With the Admonition snippet you can use Docusaurus admonition syntax to highlight rich content in the Content Editor. ... The Code Block snippet allows you to create Docusaurus code blocks with syntax highlighting, titles, and line numbers.
GitHub
github.com › facebook › docusaurus › blob › main › website › docs › guides › markdown-features › markdown-features-code-blocks.mdx
docusaurus/website/docs/guides/markdown-features/markdown-features-code-blocks.mdx at main · facebook/docusaurus
Every magic comment entry will contain three keys: className (required), line, which applies to the directly next line, or block (containing start and end), which applies to the entire block enclosed by the two comments. Using CSS to target the class can already do a lot, but you can unlock the full potential of this feature through swizzling. npm run swizzle @docusaurus/theme-classic CodeBlock/Line
Author: facebook
Saucelabs
opensource.saucelabs.com › docusaurus-theme-github-codeblock
Docusaurus Theme GitHub Codeblock | docusaurus-theme-github-codeblock
A Docusaurus v2 plugin that supports referencing code examples from public GitHub repositories.
Starred by 105 users
Forked by 19 users
Languages: TypeScript 51.5% | JavaScript 39.4% | CSS 9.1%
StudyRaid
app.studyraid.com › en › read › 12346 › 398574 › adding-code-blocks-with-syntax-highlighting
Understand adding code blocks with syntax highlighting
January 25, 2025 - While functional, this basic approach lacks advanced features needed for professional documentation. Docusaurus enhances this foundation through MDX integration and specialized components. For greater control over code presentation, Docusaurus provides a dedicated CodeBlock component.
Jasny
jasny.net › code blocks
Code Blocks | docusaurus-plugin-gitbook - Arnold Daniels
Code blocks with titles allow you to label your code snippets with filenames or descriptions. ... interface Config { apiUrl: string; timeout: number; debug: boolean; } const config: Config = { apiUrl: 'https://api.example.com', timeout: 5000, debug: false, }; export default config; ... export default { title: 'My Site', url: 'https://example.com', plugins: ['docusaurus-plugin-gitbook'], };