diff --git a/addons/notes/package.json b/addons/notes/package.json index 4168cf6eb6b..0393ba4b6a7 100644 --- a/addons/notes/package.json +++ b/addons/notes/package.json @@ -30,6 +30,9 @@ "@storybook/addons": "4.1.0-alpha.1", "marked": "^0.5.1" }, + "devDependencies": { + "@types/marked": "^0.4.2" + }, "peerDependencies": { "react": "*" } diff --git a/addons/notes/src/addon.ts b/addons/notes/src/addon.ts index 2ff6bb0d7a5..6adaaf06592 100644 --- a/addons/notes/src/addon.ts +++ b/addons/notes/src/addon.ts @@ -1,8 +1,10 @@ import addons, { makeDecorator } from '@storybook/addons'; -import marked from 'marked'; +import { MarkedOptions, parse as marked } from 'marked'; -function renderMarkdown(text, options) { - return marked(text, { ...marked.defaults, ...options }); +// todo why not just calling marked directly instead of wrapping it? +// todo removed { marked.defaults, options } merge. I believe this was not necessary, have to check +function renderMarkdown(text: string, options?: MarkedOptions) { + return marked(text, options); } export const withNotes = makeDecorator({ @@ -39,5 +41,3 @@ export const withMarkdownNotes = (text, options) => markdown: text, markdownOptions: options, }); - -export default withNotes; diff --git a/yarn.lock b/yarn.lock index 6065946bae3..ae599f25154 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2017,6 +2017,11 @@ resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4= +"@types/marked@^0.4.2": + version "0.4.2" + resolved "https://registry.yarnpkg.com/@types/marked/-/marked-0.4.2.tgz#64a89e53ea37f61cc0f3ee1732c555c2dbf6452f" + integrity sha512-cDB930/7MbzaGF6U3IwSQp6XBru8xWajF5PV2YZZeV8DyiliTuld11afVztGI9+yJZ29il5E+NpGA6ooV/Cjkg== + "@types/node@*", "@types/node@~10.12.1": version "10.12.1" resolved "https://registry.yarnpkg.com/@types/node/-/node-10.12.1.tgz#da61b64a2930a80fa708e57c45cd5441eb379d5b"