diff --git a/packages/docusaurus-theme-classic/src/theme/CodeBlock/index.js b/packages/docusaurus-theme-classic/src/theme/CodeBlock/index.js index d50872b79723..39738cc853b6 100644 --- a/packages/docusaurus-theme-classic/src/theme/CodeBlock/index.js +++ b/packages/docusaurus-theme-classic/src/theme/CodeBlock/index.js @@ -63,43 +63,46 @@ export default ({children, className: languageClassName, metastring}) => { }; 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`; - } + + {({className, style, tokens, getLineProps, getTokenProps}) => ( +
+            
+              {tokens.map((line, i) => {
+                const lineProps = getLineProps({line, key: i});
 
-              return (
-                
- {line.map((token, key) => ( - - ))} -
- ); - })} + if (highlightLines.includes(i + 1)) { + lineProps.className = `${lineProps.className} docusaurus-highlight-code-line`; + } + + 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 ae513b674919..f935f6dc760b 100644 --- a/packages/docusaurus-theme-classic/src/theme/CodeBlock/styles.module.css +++ b/packages/docusaurus-theme-classic/src/theme/CodeBlock/styles.module.css @@ -1,11 +1,3 @@ -.codeBlock { - border-radius: 0; - margin-bottom: 0; - overflow: hidden; - overflow-wrap: break-word; - white-space: pre-wrap; -} - .codeBlockWrapper { position: relative; } @@ -32,3 +24,18 @@ 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 74e55e379cdc..a7ad4c725885 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 f70d66bb82ef..c5bf334c7bd5 100644 --- a/packages/docusaurus-theme-live-codeblock/src/theme/CodeBlock/index.js +++ b/packages/docusaurus-theme-live-codeblock/src/theme/CodeBlock/index.js @@ -81,43 +81,46 @@ 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 217d0bc106ff..f935f6dc760b 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,12 +1,3 @@ -.codeBlock { - border-radius: 0; - font-size: inherit; - margin-bottom: 0; - overflow: hidden; - overflow-wrap: break-word; - white-space: pre-wrap; -} - .codeBlockWrapper { position: relative; } @@ -33,3 +24,18 @@ 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); +}