question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Importing and rendering MD in *.stories.mdx doesn't render code blocks correctly

See original GitHub issue

To Reproduce I have a Markdown file being imported into a .stories.mdx file and, while it renders, I’m noticing differences between the imported version and writing it directly in the mdx file. See code snippets and screenshots below.

Expected behavior I would expect the code fence to look the same in the imported file as is does if I wrote it in the *.stories.mdx file.

Screenshots If applicable, add screenshots to help explain your problem.

Code snippets If applicable, add code samples to help explain your problem.

// Readme.md

An `inline` codeblock

` ``
A fenced codeblock (without extra spaces)
` ``
// Overview.stories.mdx
import { Meta, Description } from '@storybook/addon-docs/blocks';
import Readme from '../Readme.md';

<Meta title="Overview" />

<Description>{Readme}</Description>

System

Environment Info:

System: OS: macOS 11.1 CPU: (8) x64 Intel® Core™ i7-7820HQ CPU @ 2.90GHz Binaries: Node: 12.19.0 - ~/.nvm/versions/node/v12.19.0/bin/node Yarn: 1.22.4 - /usr/local/bin/yarn npm: 6.14.8 - ~/.nvm/versions/node/v12.19.0/bin/npm Browsers: Chrome: 87.0.4280.88 Firefox: 84.0 Safari: 14.0.2

Additional context It seemed like some people were having similar issues over in #7644

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
TheMightyPenguincommented, Apr 7, 2021
1reaction
TheMightyPenguincommented, Mar 18, 2021

@shilman I’d like to give this one a shot! 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

MDX - Storybook
MDX -flavored Component Story Format (CSF) includes a collection of components called "Doc Blocks", that allow Storybook to translate MDX files into Storybook ......
Read more >
Troubleshooting MDX
This article goes through several common problems and errors that might occur when using MDX.
Read more >
Imported MD in MDX renders unstyled #13604 - Issuehunt
Describe the bug When I import a bare markdown file into an MDX story, and render it, it displays unstyled (e.g. Times New...
Read more >
Adding MDX Pages | Gatsby
Importing JSX components into MDX documents. MDX allows you to use React components alongside Markdown. You can import components from third-party libraries ( ......
Read more >
Newest 'mdxjs' Questions - Page 2 - Stack Overflow
Do not convert code-blocks inside a `<pre>` tag ... How to correctly use @mdx-js/loader with create-react-app? ... But i'm not able to make...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found