This repository contains the documentation for Puffer Finance products.
We've implemented several fixes to resolve MDX compilation errors that occurred with Docusaurus 3.x:
-
Configuration Changes:
- Updated
docusaurus.config.js
to use appropriate MDX options:- Set
format: 'detect'
to automatically detect the MDX format - Properly configured KaTeX for math rendering
- Set
- Updated
-
Markdown File Fixes:
- Simplified math expressions by removing unnecessary backslash escaping
- Converted simple expressions like
\(22\%\)
to regular text22%
- For complex math equations, used proper KaTeX syntax with
$$...$$
- Added comments to prevent JSX from being parsed as JavaScript
- Ensured all code blocks have explicit language tags
- Added MDX comments around problematic areas to prevent incorrect parsing
-
Fix Script:
- Created a script (
scripts/fixMdx.js
) that automatically fixes these issues - The script targets specific line ranges that were causing errors
- Handles acorn parse errors in JSX expressions
- Created a script (
To work on this documentation:
-
Install dependencies:
npm install
-
Start the development server:
npm start
-
Build the static site:
npm run build
The documentation uses KaTeX for rendering mathematical expressions. Use the following syntax:
- For simple percentage values, use regular Markdown:
22%
(not\(22\%\)
) - For emphasis, use standard Markdown:
**bold text**
(not math expressions) - For complex math formulas, use KaTeX block notation:
$$ \text{formula goes here} $$
If you encounter MDX compilation errors:
-
Run the fix script:
node scripts/fixMdx.js
-
Check the error messages for specific line numbers and file paths
-
If needed, manually add
{/* MDX-BLOCK-START */}
and{/* MDX-BLOCK-END */}
comments around problematic content -
Ensure all code blocks have language tags
-
For JSX expressions that cause acorn parse errors, wrap them with
{/* JSX-FIX */}
and{/* END-JSX-FIX */}