Skip to content

Commit d938ff7

Browse files
authored
fix(theme-classic): code block line number display with line wrapping (facebook#7910)
* fix: line numbers display issue of code block * test: add dogfooding test page * chore: lint * test: move to code-block-tests
1 parent e1a8db7 commit d938ff7

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

packages/docusaurus-theme-classic/src/theme/CodeBlock/Line/styles.module.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ the background in custom CSS file due bug https://github.com/facebook/docusaurus
3535
left: 0;
3636
padding: 0 var(--ifm-pre-padding);
3737
background: var(--ifm-pre-background);
38+
overflow-wrap: normal;
3839
}
3940

4041
.codeLineNumber::before {

website/_dogfooding/_pages tests/code-block-tests.mdx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,3 +249,21 @@ echo "short_initially_hidden_string"
249249
</Tabs>
250250

251251
[// spell-checker:enable]: #
252+
253+
```jsx showLineNumbers
254+
import React from 'react';
255+
import Layout from '@theme/Layout';
256+
257+
export default function MyReactPage() {
258+
return (
259+
<Layout>
260+
<h1>My React page</h1>
261+
<p>
262+
This is a React page. Let's make this sentence bit long. Some more words
263+
to make sure... Some more words to make sure... Some more words to make
264+
sure...
265+
</p>
266+
</Layout>
267+
);
268+
}
269+
```

0 commit comments

Comments
 (0)