diff --git a/packages/docusaurus-theme-classic/src/theme/CodeBlock/index.js b/packages/docusaurus-theme-classic/src/theme/CodeBlock/index.js index 39738cc853b6..d50872b79723 100644 --- a/packages/docusaurus-theme-classic/src/theme/CodeBlock/index.js +++ b/packages/docusaurus-theme-classic/src/theme/CodeBlock/index.js @@ -63,46 +63,43 @@ export default ({children, className: languageClassName, metastring}) => { }; return ( -
- + + {({className, style, tokens, getLineProps, getTokenProps}) => ( +
+
+            {tokens.map((line, i) => {
+              const lineProps = getLineProps({line, key: i});
 
-      
-        {({className, style, tokens, getLineProps, getTokenProps}) => (
-          
-            
-              {tokens.map((line, i) => {
-                const lineProps = getLineProps({line, key: i});
+              if (highlightLines.includes(i + 1)) {
+                lineProps.className = `${lineProps.className} docusaurus-highlight-code-line`;
+              }
 
-                if (highlightLines.includes(i + 1)) {
-                  lineProps.className = `${lineProps.className} docusaurus-highlight-code-line`;
-                }
-
-                return (
-                  
- {line.map((token, key) => ( - - ))} -
- ); - })} -
+ return ( +
+ {line.map((token, key) => ( + + ))} +
+ ); + })}
- )} -
-
+ +
+ )} + ); }; diff --git a/packages/docusaurus-theme-classic/src/theme/CodeBlock/styles.module.css b/packages/docusaurus-theme-classic/src/theme/CodeBlock/styles.module.css index fe4c9a644d28..16e20f6215b9 100644 --- a/packages/docusaurus-theme-classic/src/theme/CodeBlock/styles.module.css +++ b/packages/docusaurus-theme-classic/src/theme/CodeBlock/styles.module.css @@ -4,6 +4,14 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ + +.codeBlock { + border-radius: 0; + margin-bottom: 0; + overflow: hidden; + overflow-wrap: break-word; + white-space: pre-wrap; +} .codeBlockWrapper { position: relative; @@ -31,18 +39,3 @@ transition: opacity 200ms ease-in-out, visibility 200ms ease-in-out, bottom 200ms ease-in-out; } - -.codeBlock { - overflow: auto; - display: block; - padding: 0; - font-size: inherit; -} - -.codeBlockLines { - border-radius: 0; - margin-bottom: 0; - float: left; - min-width: 100%; - padding: var(--ifm-pre-padding); -} diff --git a/packages/docusaurus-theme-classic/src/theme/DocItem/index.js b/packages/docusaurus-theme-classic/src/theme/DocItem/index.js index a7ad4c725885..74e55e379cdc 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocItem/index.js +++ b/packages/docusaurus-theme-classic/src/theme/DocItem/index.js @@ -94,7 +94,7 @@ function DocItem(props) {
-
+
{version && ( diff --git a/packages/docusaurus-theme-live-codeblock/src/theme/CodeBlock/index.js b/packages/docusaurus-theme-live-codeblock/src/theme/CodeBlock/index.js index c5bf334c7bd5..f70d66bb82ef 100644 --- a/packages/docusaurus-theme-live-codeblock/src/theme/CodeBlock/index.js +++ b/packages/docusaurus-theme-live-codeblock/src/theme/CodeBlock/index.js @@ -81,46 +81,43 @@ export default ({ }; return ( -
- - - - {({className, style, tokens, getLineProps, getTokenProps}) => ( -
-            
-              {tokens.map((line, i) => {
-                const lineProps = getLineProps({line, key: i});
-
-                if (highlightLines.includes(i + 1)) {
-                  lineProps.className = `${lineProps.className} docusaurus-highlight-code-line`;
-                }
-
-                return (
-                  
- {line.map((token, key) => ( - - ))} -
- ); - })} -
+ + {({className, style, tokens, getLineProps, getTokenProps}) => ( +
+
+            {tokens.map((line, i) => {
+              const lineProps = getLineProps({line, key: i});
+
+              if (highlightLines.includes(i + 1)) {
+                lineProps.className = `${lineProps.className} docusaurus-highlight-code-line`;
+              }
+
+              return (
+                
+ {line.map((token, key) => ( + + ))} +
+ ); + })}
- )} - -
+ +
+ )} + ); }; diff --git a/packages/docusaurus-theme-live-codeblock/src/theme/CodeBlock/styles.module.css b/packages/docusaurus-theme-live-codeblock/src/theme/CodeBlock/styles.module.css index f935f6dc760b..217d0bc106ff 100644 --- a/packages/docusaurus-theme-live-codeblock/src/theme/CodeBlock/styles.module.css +++ b/packages/docusaurus-theme-live-codeblock/src/theme/CodeBlock/styles.module.css @@ -1,3 +1,12 @@ +.codeBlock { + border-radius: 0; + font-size: inherit; + margin-bottom: 0; + overflow: hidden; + overflow-wrap: break-word; + white-space: pre-wrap; +} + .codeBlockWrapper { position: relative; } @@ -24,18 +33,3 @@ transition: opacity 200ms ease-in-out, visibility 200ms ease-in-out, bottom 200ms ease-in-out; } - -.codeBlock { - overflow: auto; - display: block; - padding: 0; - font-size: inherit; -} - -.codeBlockLines { - border-radius: 0; - margin-bottom: 0; - float: left; - min-width: 100%; - padding: var(--ifm-pre-padding); -}