Addon-docs: When using storybook for angular, cant load docs
See original GitHub issueDescribe 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:
- Create storybook
- Install addon-docs by using the manual configuration described here: https://www.npmjs.com/package/@storybook/addon-docs
- 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:
- Created 4 years ago
- Comments:11 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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
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.