question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[addon-docs] Newlines not rendered in markdown code blocks in prop comments

See original GitHub issue

Describe the bug When adding code blocks to a docblock in markdown format, they appear in Storybook as a single line instead of properly formatted.

To Reproduce Add the following comment to a propType declaration:

/**
 * ```
 * classNames={{
 *   appear: 'my-appear',
 *   appearActive: 'my-active-appear',
 *   appearDone: 'my-done-appear',
 *   enter: 'my-enter',
 *   enterActive: 'my-active-enter',
 *   enterDone: 'my-done-enter',
 *   exit: 'my-exit',
 *   exitActive: 'my-active-exit',
 *   exitDone: 'my-done-exit',
 * }}
 * ```
 */

Expected behavior It should appear in Storybook as follows:

classNames={{
  appear: 'my-appear',
  appearActive: 'my-active-appear',
  appearDone: 'my-done-appear',
  enter: 'my-enter',
  enterActive: 'my-active-enter',
  enterDone: 'my-done-enter',
  exit: 'my-exit',
  exitActive: 'my-active-exit',
  exitDone: 'my-done-exit',
}}

Actual Behavior It appears as:

classNames={{ appear: 'my-appear', appearActive: 'my-active-appear', appearDone: 'my-done-appear', enter: 'my-enter', enterActive: 'my-active-enter', enterDone: 'my-done-enter', exit: 'my-exit', exitActive: 'my-active-exit', exitDone: 'my-done-exit', }}

System:

Environment Info:

  System:
    OS: macOS 10.15.5
    CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
  Binaries:
    Node: 12.16.1 - ~/.nvm/versions/node/v12.16.1/bin/node
    npm: 6.14.5 - ~/Desktop/react-skeleton-generator/waltz/node_modules/.bin/npm
  Browsers:
    Chrome: 83.0.4103.116
    Firefox: 77.0.1
    Safari: 13.1.1
  npmPackages:
    @storybook/addon-a11y: ^5.3.19 => 5.3.19
    @storybook/addon-actions: ^5.3.19 => 5.3.19
    @storybook/addon-docs: ^5.3.19 => 5.3.19
    @storybook/addon-knobs: ^5.3.19 => 5.3.19
    @storybook/addon-links: ^5.3.19 => 5.3.19
    @storybook/addon-viewport: ^5.3.19 => 5.3.19
    @storybook/addons: ^5.3.19 => 5.3.19
    @storybook/react: ^5.3.19 => 5.3.19

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
niklasmhcommented, Oct 22, 2020

@shilman Superb! I am more than happy to do an attempt 😄

0reactions
shilmancommented, Aug 23, 2021

Jeepers creepers!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.4.0-alpha.31 containing PR #12882 that references this issue. Upgrade today to the @next NPM tag to try it out!

npx sb upgrade --prerelease
Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I insert a blank un-formatted line in code block in ...
I just solved it, thanks to a comment (which has since been deleted). To force separate code blocks, place a <blank> tag between...
Read more >
@storybook/addon-viewport | Yarn - Package Manager
Storybook Viewport Addon allows your stories to be displayed in different sizes and layouts in Storybook. This helps build responsive components inside of ......
Read more >
DocsPage code preview indentation is wrong. #8078 - Issuehunt
Go to DocsPage for that component; Click "Code" button to bring up code preview; See wrong indentation for code preview. Expected behavior The...
Read more >
Docs Addon | Storybook: Frontend workshop for UI development
Document component usage and properties in Markdown. ... text descriptions, docgen comments, props tables, and code examples into clean, readable pages.
Read more >
CHANGELOG · master · Papa Dragon / core · GitLab
Do not show summary if it is equal to body. 829. - Update code tag styling so bbcode [code] blocks and wiki markdown...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found