You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
EDIT: Possible duplicate of #11358 (as it describes the same problem), thus this issue focuses on TypeScript interfaces and not propTypes (I have no idea if they use the same rules for code block rendering).
Describe the bug
Code formatting in ArgsTable descriptions does not support linebreaks/wrap/newlines. More specifically, the code blocks that are actually blocks behaves like inline elements.
To Reproduce
Steps to reproduce the behavior:
Create a TypeScript component with an interface with at least one property.
Add a JSDoc comment (with a multiline code block, e.g. ```\nline1\nline2\n```) before one of the properties.
Create a MDX story and include the component as well as an ArgsTable for that story.
Expected behavior
I would expect that code blocks (i.e. <pre><code>Code block</code></pre>, not <code>Inline code</code>) treated newlines as new lines.
The examples provided in the screenshots below should look like this:
Inline code: test // This code should *not* support newlines
Block code:
line1 // This code should support newlines
line2
Screenshots
This code:
Generates this:
Behind the scenes, the HTML is correct, meaning the problem is in the CSS. The CSS needs to specify pre > code to use white-space: pre-wrap and not white-space: nowrap as it currently does:
The text was updated successfully, but these errors were encountered:
niklasmh
changed the title
ArgsTable description does not format code blocks correctly (they do not include newlines)
ArgsTable Markdown description does not format code blocks correctly (they do not include newlines)
Oct 21, 2020
niklasmh
changed the title
ArgsTable Markdown description does not format code blocks correctly (they do not include newlines)
[addon-docs] ArgsTable Markdown description does not format code blocks correctly (they do not include newlines)
Oct 21, 2020
niklasmh
changed the title
[addon-docs] ArgsTable Markdown description does not format code blocks correctly (they do not include newlines)
[addon-docs] ArgsTable Markdown description does not include newlines in code blocks
Oct 21, 2020
EDIT: Possible duplicate of #11358 (as it describes the same problem), thus this issue focuses on TypeScript interfaces and not propTypes (I have no idea if they use the same rules for code block rendering).
Describe the bug
Code formatting in ArgsTable descriptions does not support linebreaks/wrap/newlines. More specifically, the code blocks that are actually blocks behaves like inline elements.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
I would expect that code blocks (i.e.
<pre><code>Code block</code></pre>
, not<code>Inline code</code>
) treated newlines as new lines.The examples provided in the screenshots below should look like this:
Inline code:
test // This code should *not* support newlines
Block code:
Screenshots
This code:
Generates this:
![image](https://user-images.githubusercontent.com/8504538/96704486-70978d80-1394-11eb-9152-7d03e8ed78e0.png)
Behind the scenes, the HTML is correct, meaning the problem is in the CSS. The CSS needs to specify
![image](https://user-images.githubusercontent.com/8504538/96704743-b2283880-1394-11eb-9198-e4514c06121a.png)
pre > code
to usewhite-space: pre-wrap
and notwhite-space: nowrap
as it currently does:System
Without newlines:
Environment Info: System: OS: Linux 4.4 Ubuntu 20.04.1 LTS (Focal Fossa) CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz CPU @ 2.40GHz Binaries: Node: 10.19.0 - /usr/bin/node Yarn: 1.22.4 - /usr/local/bin/yarn npm: 6.14.4 - /mnt/c/Users/niklas.hole/Documents/GitHub/ctrl/node_modules/.bin/npm npmPackages: @storybook/addon-controls: ^6.0.20 => 6.0.20 @storybook/addon-essentials: ^6.0.20 => 6.0.20 @storybook/addon-storysource: ^6.0.20 => 6.0.20 @storybook/client-api: ^6.0.21 => 6.0.21 @storybook/react: ^6.0.20 => 6.0.20
With newlines (much easier to read, eh?):
The text was updated successfully, but these errors were encountered: