-
Notifications
You must be signed in to change notification settings - Fork 8
CodeBlock mis-indents string children in MDX #226
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
CodeBlock renders incorrect indentation for MDX string children wrapped in {...}.
To Reproduce
- Render this MDX:
<CodeBlock filename="example.ts" language="ts">
{`import {
a,
b,
} from 'pkg';
async function main() {
console.log('hello');
}`}
</CodeBlock>- Open the rendered page.
- Observe the indentation of the lines inside the code block.
Expected behavior
The code should render with the same indentation as written in the string:
import {
a,
b,
} from 'pkg';
async function main() {
console.log('hello');
}Device:
- OS: macOS
- Browser: Chrome
- Version: latest
Additional context
Raw code inside <CodeBlock>...</CodeBlock> causes MDX parsing issues, so wrapping the code in {...} is required. The source string indentation is correct, but the rendered output still appears mis-indented.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
