Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

storybook/notes addon is rendering markdown tables preceeded by numerous <br> tags #3724

Closed
rapheld opened this issue Jun 6, 2018 · 2 comments

Comments

@rapheld
Copy link

rapheld commented Jun 6, 2018

If you are reporting a bug or requesting support, start here:

Bug or support request summary

I am using the storybook/notes addon. When rendering a table using markdown, I am getting a bunch of <br> elements between the proceeding element and the table. This is causing the table to display much farther down the page than intended.

I don't know if this is from something in Notes or a bug in marked.

Steps to reproduce

We are using Notes to display the README.md file associated with a component.

Please specify which version of Storybook and optionally any affected addons that you're running

  • @storybook/react 3.4.3
  • @storybook/addon-notes 3.4.3
// package.json
"@storybook/addon-console": "1.0.0",
"@storybook/addon-info": "3.4.3",
"@storybook/addon-knobs": "3.4.3",
"@storybook/addon-notes": "3.4.3",
"@storybook/addon-options": "3.4.3",
"@storybook/react": "3.4.3",

Affected platforms

  • Google Chrome 66.0.3359.181 (Official Build) (64-bit), OSX 10.12.6
  • Seen elsewhere: FF on OSX (don't know versions)

Screenshots / Screencast / Code Snippets (Optional)

Markdown

storybook_markdown

Rendered page

storybook_markdown_rendered

DOM

storybook_markdown_dom

@Keraito
Copy link
Contributor

Keraito commented Jun 6, 2018

Hey @rapheld, I looked into it and it is caused by Storybook, specifically here: https://github.com/storybooks/storybook/blob/master/addons/notes/src/register.js#L48. The table creates a string of HTML elements, with each of them proceeded by a \n. All of them thus get extended with a <br />, causing the issue that you're reporting. Unfortunately, there is no negative lookbehind in js, so we will have to find another decent solution.

@Hypnosphi
Copy link
Member

Released as 3.4.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants