@docusaurus/theme-classic 3.9.2-canary-6448 → 3.9.2-canary-6450

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,8 +8,16 @@ import React from 'react';
8
8
  import clsx from 'clsx';
9
9
  import LineToken from '@theme/CodeBlock/Line/Token';
10
10
  import styles from './styles.module.css';
11
- // Replaces '\n' by ''
12
- // Historical code, not sure why we even need this :/
11
+ // This <br/ seems useful when the line has no content to prevent collapsing.
12
+ // For code blocks with "diff" languages, this makes the empty lines collapse to
13
+ // zero height lines, which is undesirable.
14
+ // See also https://github.com/facebook/docusaurus/pull/11565
15
+ function LineBreak() {
16
+ return <br />;
17
+ }
18
+ // Replaces single lines with '\n' by '' so that we don't end up with
19
+ // duplicate line breaks (the '\n' + the artificial <br/> above)
20
+ // see also https://github.com/facebook/docusaurus/pull/11565
13
21
  function fixLineBreak(line) {
14
22
  const singleLineBreakToken =
15
23
  line.length === 1 && line[0].content === '\n' ? line[0] : undefined;
@@ -39,7 +47,7 @@ export default function CodeBlockLine({
39
47
  );
40
48
  });
41
49
  return (
42
- <span {...lineProps}>
50
+ <div {...lineProps}>
43
51
  {showLineNumbers ? (
44
52
  <>
45
53
  <span className={styles.codeLineNumber} />
@@ -48,7 +56,7 @@ export default function CodeBlockLine({
48
56
  ) : (
49
57
  lineTokens
50
58
  )}
51
- <br />
52
- </span>
59
+ <LineBreak />
60
+ </div>
53
61
  );
54
62
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/theme-classic",
3
- "version": "3.9.2-canary-6448",
3
+ "version": "3.9.2-canary-6450",
4
4
  "description": "Classic theme for Docusaurus",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/theme-classic.d.ts",
@@ -20,19 +20,19 @@
20
20
  "copy:watch": "node ../../admin/scripts/copyUntypedFiles.js --watch"
21
21
  },
22
22
  "dependencies": {
23
- "@docusaurus/core": "3.9.2-canary-6448",
24
- "@docusaurus/logger": "3.9.2-canary-6448",
25
- "@docusaurus/mdx-loader": "3.9.2-canary-6448",
26
- "@docusaurus/module-type-aliases": "3.9.2-canary-6448",
27
- "@docusaurus/plugin-content-blog": "3.9.2-canary-6448",
28
- "@docusaurus/plugin-content-docs": "3.9.2-canary-6448",
29
- "@docusaurus/plugin-content-pages": "3.9.2-canary-6448",
30
- "@docusaurus/theme-common": "3.9.2-canary-6448",
31
- "@docusaurus/theme-translations": "3.9.2-canary-6448",
32
- "@docusaurus/types": "3.9.2-canary-6448",
33
- "@docusaurus/utils": "3.9.2-canary-6448",
34
- "@docusaurus/utils-common": "3.9.2-canary-6448",
35
- "@docusaurus/utils-validation": "3.9.2-canary-6448",
23
+ "@docusaurus/core": "3.9.2-canary-6450",
24
+ "@docusaurus/logger": "3.9.2-canary-6450",
25
+ "@docusaurus/mdx-loader": "3.9.2-canary-6450",
26
+ "@docusaurus/module-type-aliases": "3.9.2-canary-6450",
27
+ "@docusaurus/plugin-content-blog": "3.9.2-canary-6450",
28
+ "@docusaurus/plugin-content-docs": "3.9.2-canary-6450",
29
+ "@docusaurus/plugin-content-pages": "3.9.2-canary-6450",
30
+ "@docusaurus/theme-common": "3.9.2-canary-6450",
31
+ "@docusaurus/theme-translations": "3.9.2-canary-6450",
32
+ "@docusaurus/types": "3.9.2-canary-6450",
33
+ "@docusaurus/utils": "3.9.2-canary-6450",
34
+ "@docusaurus/utils-common": "3.9.2-canary-6450",
35
+ "@docusaurus/utils-validation": "3.9.2-canary-6450",
36
36
  "@mdx-js/react": "^3.0.0",
37
37
  "clsx": "^2.0.0",
38
38
  "infima": "0.2.0-alpha.45",
@@ -61,5 +61,5 @@
61
61
  "engines": {
62
62
  "node": ">=20.0"
63
63
  },
64
- "gitHead": "ae30a9210d4e3dea606b00df6a7e04ee08af5195"
64
+ "gitHead": "ce94bc05c81f98b1f1b4022e919fe3b43dc22fc5"
65
65
  }
@@ -14,16 +14,23 @@ import styles from './styles.module.css';
14
14
 
15
15
  type Token = Props['line'][number];
16
16
 
17
- // Replaces '\n' by ''
18
- // Historical code, not sure why we even need this :/
17
+ // This <br/ seems useful when the line has no content to prevent collapsing.
18
+ // For code blocks with "diff" languages, this makes the empty lines collapse to
19
+ // zero height lines, which is undesirable.
20
+ // See also https://github.com/facebook/docusaurus/pull/11565
21
+ function LineBreak() {
22
+ return <br />;
23
+ }
24
+
25
+ // Replaces single lines with '\n' by '' so that we don't end up with
26
+ // duplicate line breaks (the '\n' + the artificial <br/> above)
27
+ // see also https://github.com/facebook/docusaurus/pull/11565
19
28
  function fixLineBreak(line: Token[]) {
20
29
  const singleLineBreakToken =
21
30
  line.length === 1 && line[0]!.content === '\n' ? line[0] : undefined;
22
-
23
31
  if (singleLineBreakToken) {
24
32
  return [{...singleLineBreakToken, content: ''}];
25
33
  }
26
-
27
34
  return line;
28
35
  }
29
36
 
@@ -35,7 +42,6 @@ export default function CodeBlockLine({
35
42
  getTokenProps,
36
43
  }: Props): ReactNode {
37
44
  const line = fixLineBreak(lineProp);
38
-
39
45
  const lineProps = getLineProps({
40
46
  line,
41
47
  className: clsx(classNames, showLineNumbers && styles.codeLine),
@@ -51,7 +57,7 @@ export default function CodeBlockLine({
51
57
  });
52
58
 
53
59
  return (
54
- <span {...lineProps}>
60
+ <div {...lineProps}>
55
61
  {showLineNumbers ? (
56
62
  <>
57
63
  <span className={styles.codeLineNumber} />
@@ -60,7 +66,7 @@ export default function CodeBlockLine({
60
66
  ) : (
61
67
  lineTokens
62
68
  )}
63
- <br />
64
- </span>
69
+ <LineBreak />
70
+ </div>
65
71
  );
66
72
  }