-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unterminated template when parsing template literals with multiple newlines (regression from v1) #1945
Comments
Heya! Hmm, two things. First, your abbreviated problem:
That won’t work and is expected: https://mdxjs.com/docs/what-is-mdx/#interleaving. In markdown, those first are two paragraphs. And well, you can’t have that:
Second, is not completely “expected”, but also not “not expected”, following to the interleaving section:
Can you do this?
|
Hi @wooorm thanks so much for getting back to me. I updated the example to make it a little more readable and realized it was not exactly what I wanted to convey (though the behavior is the same). Original (broken)
The "original" version worked with MDXv1 and we shipped it to tens of thousands of users as part of the example template in Storybook Docs. Now in MDXv2 it's broken. It feels like a regression to me, but if that's the expected behavior I'm totally fine with it -- I realize that's what major versions are for. Updated1 (works)
Updated2 (also works)
DiscussionBoth updated versions work. I could update our template accordingly, and provide migration instructions or potentially even ship a codemod to update users' code accordingly. Before I do that, however, I want to confirm:
Thanks again for your help! And congratulations on the v2 release--super excited to get this into users' hands!!!! 🎉 |
Thanks for your patience. This is indeed expected behavior. Updated2 is what I recommend, yeah. The braces start and end a “block” by being on their own lines. I’m still thinking of whether there’s a good reason and technical possibility to allow your original code anyway, I’m leaning towards it, not 100% sure yet though. Thanks for all your kind words :) |
This comment was marked as off-topic.
This comment was marked as off-topic.
@brendonco you’re probably better off asking questions about storybook betas in storybook repos |
* Breaking after upgrading to MDXv2 * Related to mdx-js/mdx#1945
* Breaking after upgrading to MDXv2 * Related to mdx-js/mdx#1945
* Breaking after upgrading to MDXv2 * Related to mdx-js/mdx#1945
* Breaking after upgrading to MDXv2 * Related to mdx-js/mdx#1945
* Breaking after upgrading to MDXv2 * Related to mdx-js/mdx#1945
* Breaking after upgrading to MDXv2 * Related to mdx-js/mdx#1945
* Breaking after upgrading to MDXv2 * Related to mdx-js/mdx#1945
* Breaking after upgrading to MDXv2 * Related to mdx-js/mdx#1945
* Breaking after upgrading to MDXv2 * Related to mdx-js/mdx#1945
* Breaking after upgrading to MDXv2 * Related to mdx-js/mdx#1945
* Breaking after upgrading to MDXv2 * Related to mdx-js/mdx#1945
* Breaking after upgrading to MDXv2 * Related to mdx-js/mdx#1945
* Breaking after upgrading to MDXv2 * Related to mdx-js/mdx#1945
* Breaking after upgrading to MDXv2 * Related to mdx-js/mdx#1945
Related-to: micromark/micromark-extension-mdx-jsx#9. Related-to: mdx-js/mdx#1945.
Initial checklist
Affected packages and versions
@mdx-js/mdx
Link to runnable example
https://stackblitz.com/edit/github-rumgbj?file=index.js
Steps to reproduce
Add an extra
\n
between.foo
and.bar
styles in the linked stackblitz exampleExpected behavior
It should compile successfully. We are using this pattern in Storybook's starter template:
https://raw.githubusercontent.com/storybookjs/storybook/next/lib/cli/src/frameworks/common/Introduction.stories.mdx
Actual behavior
It will crash with
Or perhaps this is an intentional breaking change in MDXv2?
Runtime
No response
Package manager
No response
OS
No response
Build and bundle tools
No response
The text was updated successfully, but these errors were encountered: