addon-notes and importing an .md file
See original GitHub issueGreetings!
Describe the bug
I try to import an .md file in my stories.js
file and use it as a context for notes. But when I run npm run storybook:serve
I get next message:
ERROR in ./src/notes/icon.md 1:0
Module parse failed: Unexpected character '#' (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> ### Attributes
@ ./src/stories/icon.stories.js 8:0-41 78:14-23
@ ./src/stories sync .stories.js$
@ ./config/storybook/config.js
@ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./config/storybook/config.js ./node_modules/webpack-hot-middleware/client.js?reload=true
Expected behavior
Documentation of addons/notes
says it’s possible to use markdown external files. I want to use it the same way.
import markdownNotes from './someMarkdownText.md';
storiesOf('Component', module).add('With Markdown', () => <Component />, {
notes: { markdown: markdownNotes },
});
Code snippets This is my .md file
### Attributes
And this is my .stories.js file
import { storiesOf } from '@storybook/vue';
import { text } from '@storybook/addon-knobs';
import iconNotes from '../notes/icon.md';
const componentStories = storiesOf('Components/Icon', module);
const template = '<div></div>' // just an example
componentStories.add(
'Default',
() => ({
template: template,
}),
{
notes: { markdown: iconNotes }
}
);
System:
System:
OS: macOS 10.14.5
Binaries:
Node: 10.16.0 - /usr/local/bin/node
Yarn: 1.5.1 - /usr/local/bin/yarn
npm: 6.9.0 - /usr/local/bin/npm
Some info from package.json
file:
{
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"icon:generate": "node config/icon-generator.js",
"build-bundle": "vue-cli-service build --target lib --name tmc-ui ./src/components/index.js",
"storybook:build": "node config/icon-generator.js && vue-cli-service storybook:build -c config/storybook",
"storybook:serve": "node config/icon-generator.js && vue-cli-service storybook:serve -p 6006 -c config/storybook",
"test:unit": "vue-cli-service test:unit"
},
"dependencies": {
"moment": "^2.23.0",
"svg-sprite-loader": "^4.1.3",
"vue": "^2.6.8",
"vue-class-component": "^6.0.0",
"vue-property-decorator": "^7.2.0"
},
"devDependencies": {
"@storybook/addon-actions": "^5.1.9",
"@storybook/addon-knobs": "^5.1.9",
"@storybook/addon-links": "^5.1.9",
"@storybook/addon-notes": "^5.1.9",
"@storybook/addon-options": "^5.1.9",
"@storybook/addons": "^5.1.9",
"@types/chai": "^4.1.0",
"@types/mocha": "^5.2.4",
"@types/node": "^10.12.12",
"@vue/cli-plugin-babel": "^3.2.0",
"@vue/cli-plugin-typescript": "^3.2.0",
"@vue/cli-plugin-unit-mocha": "^3.2.0",
"@vue/cli-service": "^3.2.0",
"@vue/test-utils": "^1.0.0-beta.20",
"chai": "^4.1.2",
"lint-staged": "^7.2.2",
"node-sass": "^4.9.0",
"sass-loader": "^7.0.1",
"typescript": "^3.0.0",
"vue-cli-plugin-storybook": "^0.6.1",
"vue-template-compiler": "^2.6.8"
},
"files": [
"dist/*",
"src/*",
"public/*",
"*.json",
"*.js"
],
}
Additional context
BTW when I use not an external .md file (I mean when I place any context as a markdown
value) it has no errors.
// some code above
{
notes: { markdown: "### Attributes" }
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
StorybookJS: Tips & Tricks. Import Markdown files as ... - ITNEXT
Import Markdown Files Into StorybookJS. One particularly cool feature of StencilJS is that, out of the box, it auto-generates readme.md files in ...
Read more >storybook/addon-docs - npm
The transcludeMarkdown option enables mdx files to import .md files and render them as a component. import { Meta } from '@storybook/addon-docs ...
Read more >Importing Markdown Files - MadCap Flare's Online Help
Importing Markdown Files. Markdown is a markup language using plain formatting syntax. You can import Markdown (.md) files into Flare projects.
Read more >Writing storybook inlined with markdown - Tomasz Pluskiewicz
Using markdown and web components to write documentation within the actual ... There are addons but they are not presentable enough (addon-notes) or...
Read more >Import Markdown files into a project - Adobe Support
md ) file. Then, select File > Import > Markdown File. Right-click the desired folder or click against it and select Import ......
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
@nbrylev you can use this to load the markdown file just as storybook.
Hey there, it’s me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!