Storybook-readme: Angular Support

Created on 9 Jan 2018  路  15Comments  路  Source: tuchk4/storybook-readme

Storybook now supports Angular, as such it would be awesome if this library were to implement it too.

help wanted

Most helpful comment

Yeah, I am going to add Angular support a bit later

All 15 comments

Yeah, I am going to add Angular support a bit later

It actually works, should probably just update readmes.

@amcdnl how you make it work
I got error import README1 from '../src/framework/content/README1.md';
error TS2307: Cannot find module '../src/framework/content/README1.md'.
image

Add this:

declare module '*.md';

@amcdnl in wepback or where I add this line
if it is in webpack could you share it?

No, just in a root ts file.

@amcdnl Is it work correctly?
Seems withDocs method can not work :) only withReadme

Hey,

withReadme works just fine, but withDocs seems to break for me as well.

@tuchk4 do you have any updates on fully support for Angular?

Also it would be fine to have support for highlighting typescript blocks of code, most of the angular, react projects use this language. As far as I understand it is quite simple to just add import 'prismjs/components/prism-typescript'; in highlite.js file. What do you think, @tuchk4 ?

@andrei-ilyukovich right now I have no time to update code to fully support angular.

But I would be happy for any help.

+1

Thank you for considering adding support for Angular. I wish I had the skills to add support, but unfortunately no can do. If anyone will try their hand at this, you have a fan right here!
I would also just appreciate a example snippet or a PR made to the readme on how to use it in Angular, if (part of it) already works :) @amcdnl

Using with .addDecorator(withReadme(MyComponent)) I got this error :

storybook-readme: wrong arguments
    Error: storybook-readme: wrong arguments
    at http://localhost:9001/static/iframe.bundle.js:195912:15
    at Object.withReadme (http://localhost:9001/static/iframe.bundle.js:195918:70)
    at Object.<anonymous> (http://localhost:9001/static/iframe.bundle.js:202257:38)
    at Object../src/app/components/menu-applications/applications-menu.stories.ts (http://localhost:9001/static/iframe.bundle.js:202293:30)
    at __webpack_require__ (http://localhost:9001/static/iframe.bundle.js:725:30)
    at fn (http://localhost:9001/static/iframe.bundle.js:102:20)
    at webpackContext (http://localhost:9001/static/iframe.bundle.js:201761:9)
    at http://localhost:9001/static/iframe.bundle.js:828:12
    at Array.forEach (<anonymous>)

My code is like this:

storiesOf('ApplicationMenu', module)
   .addDecorator(moduleMetadata({ ... })
   .addDecorator(withReadme(MyComponent))
   .add('Basic', () => ({ ... }));

the first parameter passed to the withReadme, should be your readme file, not your component.
doc. @danielpcampagna

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JamesBliss picture JamesBliss  路  5Comments

LukyVj picture LukyVj  路  5Comments

ankurkaushal picture ankurkaushal  路  4Comments

PaulieScanlon picture PaulieScanlon  路  5Comments

callerc1 picture callerc1  路  4Comments