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
fix(stories): unwrap extra <p> tags in mdx jsx (#96351)
Follow-up to (and revert of) #96343.
Rather than shifting the burden of wrapping all JSX-in-MDX content in
expressions to authors, this PR fixes the issue by adding a new `remark`
plugin that unwraps problematic `<p>` tags.
Problematic situations where MDX introduces `<p>` tags are:
- Paragraph contains only `mdxJsxTextElement` nodes and whitespace-only
`text` nodes.
- MDX JSX element contains a single child which is a paragraph.
---------
Co-authored-by: Jonas <jonas.badalic@sentry.io>
Co-authored-by: cursor[bot] <206951365+cursor[bot]@users.noreply.github.com>
Copy file name to clipboardExpand all lines: rspack.config.ts
+3Lines changed: 3 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -24,6 +24,8 @@ import {TsCheckerRspackPlugin} from 'ts-checker-rspack-plugin';
24
24
25
25
// @ts-expect-error: ts(5097) importing `.ts` extension is required for resolution, but not enabled until `allowImportingTsExtensions` is added to tsconfig
// @ts-expect-error: ts(5097) importing `.ts` extension is required for resolution, but not enabled until `allowImportingTsExtensions` is added to tsconfig
Compressed density text. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
184
+
Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
182
185
</Text>
183
-
<Text
184
-
density="compressed"
185
-
as="p"
186
-
>{`Compressed density text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.`}</Text>
Default density text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed
191
+
do eiusmod tempor incididunt ut labore et dolore magna aliqua.
191
192
</Text>
192
-
<Textas="p">{`Default density text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.`}</Text>
193
193
</div>
194
194
<divstyle={{width: '300px'}}>
195
-
<Textboldas="p">
196
-
{`Comfortable density.`}
195
+
<Headingas="h4">Comfortable density</Heading>
196
+
<Textas="p"density="comfortable">
197
+
Comfortable density text. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
198
+
Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
197
199
</Text>
198
-
<Text
199
-
density="comfortable"
200
-
as="p"
201
-
>{`Comfortable density text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.`}</Text>
202
200
</div>
203
201
</Storybook.SideBySide>
204
202
</Storybook.Demo>
205
203
```jsx
206
-
<Text density="compressed" as="p">
207
-
Compressed density text...
208
-
</Text>
209
-
<Text as="p">Default density text...</Text>
210
-
<Text density="comfortable" as="p">
211
-
Comfortable density text...
212
-
</Text>
204
+
<Text density="compressed">Compressed density text...</Text>
205
+
<Text>Default density text...</Text>
206
+
<Text density="comfortable">Comfortable density text...</Text>
213
207
```
214
208
215
209
### Ellipsis Overflow
@@ -233,20 +227,18 @@ Use `monospace` for fixed-width text.
0 commit comments