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.

Addon-docs: When using storybook for angular, cant load docs

See original GitHub issue

Describe the bug I tried to use storybook addon-docs for my angular storybook project. After creating my first mdx story, it fail with the message SyntaxError: file: Unexpected token (15:9), pointing to JSX-syntax: return <div {...props}/>. Thats why I installed @babel/preset-react. Now everything loads fine, my template also gets displayed, but unfortunately it fails when I click on Docs with the following StackTrace

index.js:47 TypeError: Cannot read property 'toLowerCase' of undefined
    at sanitize (VM654 vendors~main.d14197376ef6ce2839d3.bundle.js:87301)
    at sanitizeSafe (VM654 vendors~main.d14197376ef6ce2839d3.bundle.js:87308)
    at toId (VM654 vendors~main.d14197376ef6ce2839d3.bundle.js:87318)
    at VM654 vendors~main.d14197376ef6ce2839d3.bundle.js:81811
    at updateContextConsumer (VM654 vendors~main.d14197376ef6ce2839d3.bundle.js:171400)
    at beginWork (VM654 vendors~main.d14197376ef6ce2839d3.bundle.js:171588)
    at performUnitOfWork (VM654 vendors~main.d14197376ef6ce2839d3.bundle.js:175228)
    at workLoop (VM654 vendors~main.d14197376ef6ce2839d3.bundle.js:175268)
    at renderRoot (VM654 vendors~main.d14197376ef6ce2839d3.bundle.js:175351)
    at performWorkOnRoot (VM654 vendors~main.d14197376ef6ce2839d3.bundle.js:176258)

To Reproduce Steps to reproduce the behavior:

  1. Create storybook
  2. Install addon-docs by using the manual configuration described here: https://www.npmjs.com/package/@storybook/addon-docs
  3. Create mdx story with <Story> tag
import { Story } from '@storybook/components';

export const componentMeta = {
  title: 'MDX|Button',
};

# Hello Docs

Welcome to the future of Storybook!

<Story name="with text">
  {{
    template: '<div class="button">Button</div>',
  }}
</Story>

Expected behavior It should render the given template and the documentation

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

System:

  • OS: MacOS
  • Device: Macbook Pro 2018
  • Browser: Chrome
  • Framework: angular
  • Addons: docs
  • Version: 5.2.0-alpha.3

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
ronnyekcommented, Sep 19, 2019

I realize react was the primary target for storybook, and as I understand what some/all of it is written in… but I think documentation and examples (and even the full setup instructions) appear to be specifically written for @storybook/react, and potentially not some of the others.

I’m running into problems attempting to get MDX support working like it should… for angular, and I have no idea what example syntax for MDX should look like for angular components. I tried the example above… and get

SyntaxError: C:\...\button-mdx.stories.mdx: Identifier 'componentMeta' has already been declared (50:6)
3reactions
daiyiscommented, Oct 2, 2020

nothing yet, reopening cc @jonniebigodes

Thanks for the update, meanwhile, is there any internal example I can reference to? the angular-cli example in the github source code doesn’t have any latest code example.

Read more comments on GitHub >

github_iconTop Results From Across the Web

storybook/addon-docs - npm
Start using @storybook/addon-docs in your project by running `npm i ... When you install Docs, every story gets a DocsPage .
Read more >
How to document components - Storybook
In both cases, you'll use Doc Blocks as the building blocks to create full featured documentation. Docs is autoconfigured to work out of...
Read more >
0 - Stack Overflow
I have developed an angular library using Nx and i am trying to create documentation using this add on for storybook ...
Read more >
Top 5 @storybook/addon-docs Code Examples - Snyk
Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately. Enable here. github storybookjs /...
Read more >
@storybook/addon-docs | Yarn - Package Manager
Decision-making · If people disagree on an implementation and it can't be resolved in discussion, they may issue alternative PR's with different ideas ......
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