Skip to content
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

Multiline template error with empty rows inside mdx #8473

Closed
artaommahe opened this issue Oct 18, 2019 · 1 comment
Closed

Multiline template error with empty rows inside mdx #8473

artaommahe opened this issue Oct 18, 2019 · 1 comment

Comments

@artaommahe
Copy link

Describe the bug
Storybook provides an error while using empty row inside multiline template in mdx files (DocsPage, angular)

Module build failed (from ./node_modules/@mdx-js/loader/index.js):
SyntaxError: unknown: Unexpected token (17:53)

  15 |       template: `
  16 |         
> 17 | 
{`    <app-root></app-root>
     |                                                      ^
  18 |   \`
  19 | }}
  20 | `}</code></pre>

To Reproduce
Steps to reproduce the behavior:

  1. clone https://github.com/artaommahe/storybook-docs-multiline-template
  2. yarn install
  3. yarn start-storybook
  4. see an error
  5. remove empty row in template https://raw.githubusercontent.com/artaommahe/storybook-docs-multiline-template/master/src/app/app.stories.mdx
  6. no error
  7. add \ at empty row
  8. no error

Expected behavior
Empty rows are allowed inside mdx template.

Code snippets

<Preview>
  <Story name="Overview">
    {{
      template: `
        <app-root></app-root>

        <app-root></app-root>
      `
    }}
  </Story>
</Preview>

It's a regular use-case for complex markup showcase or having same component multiple times in different states.

@shilman
Copy link
Member

shilman commented Oct 19, 2019

Closing as dupe to #7902

@shilman shilman closed this as completed Oct 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants