@docusaurus/theme-classic 3.9.1 → 3.9.2

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.
@@ -17,7 +17,9 @@ export default function EditMetaRow({
17
17
  }) {
18
18
  return (
19
19
  <div className={clsx('row', className)}>
20
- <div className="col">{editUrl && <EditThisPage editUrl={editUrl} />}</div>
20
+ <div className={clsx('col', styles.noPrint)}>
21
+ {editUrl && <EditThisPage editUrl={editUrl} />}
22
+ </div>
21
23
  <div className={clsx('col', styles.lastUpdated)}>
22
24
  {(lastUpdatedAt || lastUpdatedBy) && (
23
25
  <LastUpdated
@@ -16,3 +16,9 @@
16
16
  text-align: right;
17
17
  }
18
18
  }
19
+
20
+ @media print {
21
+ .noPrint {
22
+ display: none;
23
+ }
24
+ }
@@ -6,4 +6,5 @@
6
6
  */
7
7
  import { type ReactNode } from 'react';
8
8
  import type { Props } from '@theme/Heading';
9
+ import './styles.module.css';
9
10
  export default function Heading({ as: As, id, ...props }: Props): ReactNode;
@@ -7,15 +7,13 @@
7
7
  import React from 'react';
8
8
  import clsx from 'clsx';
9
9
  import {translate} from '@docusaurus/Translate';
10
- import {useThemeConfig} from '@docusaurus/theme-common';
10
+ import {useAnchorTargetClassName} from '@docusaurus/theme-common';
11
11
  import Link from '@docusaurus/Link';
12
12
  import useBrokenLinks from '@docusaurus/useBrokenLinks';
13
- import styles from './styles.module.css';
13
+ import './styles.module.css';
14
14
  export default function Heading({as: As, id, ...props}) {
15
15
  const brokenLinks = useBrokenLinks();
16
- const {
17
- navbar: {hideOnScroll},
18
- } = useThemeConfig();
16
+ const anchorTargetClassName = useAnchorTargetClassName(id);
19
17
  // H1 headings do not need an id because they don't appear in the TOC.
20
18
  if (As === 'h1' || !id) {
21
19
  return <As {...props} id={undefined} />;
@@ -34,13 +32,7 @@ export default function Heading({as: As, id, ...props}) {
34
32
  return (
35
33
  <As
36
34
  {...props}
37
- className={clsx(
38
- 'anchor',
39
- hideOnScroll
40
- ? styles.anchorWithHideOnScrollNavbar
41
- : styles.anchorWithStickyNavbar,
42
- props.className,
43
- )}
35
+ className={clsx('anchor', anchorTargetClassName, props.className)}
44
36
  id={id}>
45
37
  {props.children}
46
38
  <Link
@@ -5,19 +5,6 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- /*
9
- When the navbar is sticky, ensure that on anchor click,
10
- the browser does not scroll that anchor behind the navbar
11
- See https://x.com/JoshWComeau/status/1332015868725891076
12
- */
13
- .anchorWithStickyNavbar {
14
- scroll-margin-top: calc(var(--ifm-navbar-height) + 0.5rem);
15
- }
16
-
17
- .anchorWithHideOnScrollNavbar {
18
- scroll-margin-top: 0.5rem;
19
- }
20
-
21
8
  :global(.hash-link) {
22
9
  opacity: 0;
23
10
  padding-left: 0.5rem;
@@ -7,30 +7,11 @@
7
7
  import React from 'react';
8
8
  import clsx from 'clsx';
9
9
  import Link from '@docusaurus/Link';
10
- import {useThemeConfig} from '@docusaurus/theme-common';
11
- import styles from './styles.module.css';
12
- function isFootnoteRef(props) {
13
- return props['data-footnote-ref'] === true;
14
- }
15
- function FootnoteRefLink(props) {
16
- const {
17
- navbar: {hideOnScroll},
18
- } = useThemeConfig();
10
+ import {useAnchorTargetClassName} from '@docusaurus/theme-common';
11
+ export default function MDXA(props) {
12
+ // MDX Footnotes have ids such as <a id="user-content-fn-1-953011" ...>
13
+ const anchorTargetClassName = useAnchorTargetClassName(props.id);
19
14
  return (
20
- <Link
21
- {...props}
22
- className={clsx(
23
- hideOnScroll
24
- ? styles.footnoteRefHideOnScrollNavbar
25
- : styles.footnoteRefStickyNavbar,
26
- props.className,
27
- )}
28
- />
15
+ <Link {...props} className={clsx(anchorTargetClassName, props.className)} />
29
16
  );
30
17
  }
31
- export default function MDXA(props) {
32
- if (isFootnoteRef(props)) {
33
- return <FootnoteRefLink {...props} />;
34
- }
35
- return <Link {...props} />;
36
- }
@@ -5,9 +5,14 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import React from 'react';
8
+ import clsx from 'clsx';
8
9
  import useBrokenLinks from '@docusaurus/useBrokenLinks';
10
+ import {useAnchorTargetClassName} from '@docusaurus/theme-common';
9
11
  export default function MDXLi(props) {
10
12
  // MDX Footnotes have ids such as <li id="user-content-fn-1-953011">
11
13
  useBrokenLinks().collectAnchor(props.id);
12
- return <li {...props} />;
14
+ const anchorTargetClassName = useAnchorTargetClassName(props.id);
15
+ return (
16
+ <li className={clsx(anchorTargetClassName, props.className)} {...props} />
17
+ );
13
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/theme-classic",
3
- "version": "3.9.1",
3
+ "version": "3.9.2",
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.1",
24
- "@docusaurus/logger": "3.9.1",
25
- "@docusaurus/mdx-loader": "3.9.1",
26
- "@docusaurus/module-type-aliases": "3.9.1",
27
- "@docusaurus/plugin-content-blog": "3.9.1",
28
- "@docusaurus/plugin-content-docs": "3.9.1",
29
- "@docusaurus/plugin-content-pages": "3.9.1",
30
- "@docusaurus/theme-common": "3.9.1",
31
- "@docusaurus/theme-translations": "3.9.1",
32
- "@docusaurus/types": "3.9.1",
33
- "@docusaurus/utils": "3.9.1",
34
- "@docusaurus/utils-common": "3.9.1",
35
- "@docusaurus/utils-validation": "3.9.1",
23
+ "@docusaurus/core": "3.9.2",
24
+ "@docusaurus/logger": "3.9.2",
25
+ "@docusaurus/mdx-loader": "3.9.2",
26
+ "@docusaurus/module-type-aliases": "3.9.2",
27
+ "@docusaurus/plugin-content-blog": "3.9.2",
28
+ "@docusaurus/plugin-content-docs": "3.9.2",
29
+ "@docusaurus/plugin-content-pages": "3.9.2",
30
+ "@docusaurus/theme-common": "3.9.2",
31
+ "@docusaurus/theme-translations": "3.9.2",
32
+ "@docusaurus/types": "3.9.2",
33
+ "@docusaurus/utils": "3.9.2",
34
+ "@docusaurus/utils-common": "3.9.2",
35
+ "@docusaurus/utils-validation": "3.9.2",
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": "c0dd59f0e712f85b6053c59e46b0514b5d2d1414"
64
+ "gitHead": "abfbe5621b08407bc3dcbe6111ff118d4c22f7a1"
65
65
  }
@@ -20,7 +20,9 @@ export default function EditMetaRow({
20
20
  }: Props): ReactNode {
21
21
  return (
22
22
  <div className={clsx('row', className)}>
23
- <div className="col">{editUrl && <EditThisPage editUrl={editUrl} />}</div>
23
+ <div className={clsx('col', styles.noPrint)}>
24
+ {editUrl && <EditThisPage editUrl={editUrl} />}
25
+ </div>
24
26
  <div className={clsx('col', styles.lastUpdated)}>
25
27
  {(lastUpdatedAt || lastUpdatedBy) && (
26
28
  <LastUpdated
@@ -16,3 +16,9 @@
16
16
  text-align: right;
17
17
  }
18
18
  }
19
+
20
+ @media print {
21
+ .noPrint {
22
+ display: none;
23
+ }
24
+ }
@@ -8,18 +8,16 @@
8
8
  import React, {type ReactNode} from 'react';
9
9
  import clsx from 'clsx';
10
10
  import {translate} from '@docusaurus/Translate';
11
- import {useThemeConfig} from '@docusaurus/theme-common';
11
+ import {useAnchorTargetClassName} from '@docusaurus/theme-common';
12
12
  import Link from '@docusaurus/Link';
13
13
  import useBrokenLinks from '@docusaurus/useBrokenLinks';
14
14
  import type {Props} from '@theme/Heading';
15
-
16
- import styles from './styles.module.css';
15
+ import './styles.module.css';
17
16
 
18
17
  export default function Heading({as: As, id, ...props}: Props): ReactNode {
19
18
  const brokenLinks = useBrokenLinks();
20
- const {
21
- navbar: {hideOnScroll},
22
- } = useThemeConfig();
19
+ const anchorTargetClassName = useAnchorTargetClassName(id);
20
+
23
21
  // H1 headings do not need an id because they don't appear in the TOC.
24
22
  if (As === 'h1' || !id) {
25
23
  return <As {...props} id={undefined} />;
@@ -41,13 +39,7 @@ export default function Heading({as: As, id, ...props}: Props): ReactNode {
41
39
  return (
42
40
  <As
43
41
  {...props}
44
- className={clsx(
45
- 'anchor',
46
- hideOnScroll
47
- ? styles.anchorWithHideOnScrollNavbar
48
- : styles.anchorWithStickyNavbar,
49
- props.className,
50
- )}
42
+ className={clsx('anchor', anchorTargetClassName, props.className)}
51
43
  id={id}>
52
44
  {props.children}
53
45
  <Link
@@ -5,19 +5,6 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- /*
9
- When the navbar is sticky, ensure that on anchor click,
10
- the browser does not scroll that anchor behind the navbar
11
- See https://x.com/JoshWComeau/status/1332015868725891076
12
- */
13
- .anchorWithStickyNavbar {
14
- scroll-margin-top: calc(var(--ifm-navbar-height) + 0.5rem);
15
- }
16
-
17
- .anchorWithHideOnScrollNavbar {
18
- scroll-margin-top: 0.5rem;
19
- }
20
-
21
8
  :global(.hash-link) {
22
9
  opacity: 0;
23
10
  padding-left: 0.5rem;
@@ -8,35 +8,14 @@
8
8
  import React, {type ReactNode} from 'react';
9
9
  import clsx from 'clsx';
10
10
  import Link from '@docusaurus/Link';
11
- import {useThemeConfig} from '@docusaurus/theme-common';
11
+ import {useAnchorTargetClassName} from '@docusaurus/theme-common';
12
12
  import type {Props} from '@theme/MDXComponents/A';
13
- import styles from './styles.module.css';
14
13
 
15
- function isFootnoteRef(props: Props) {
16
- return props['data-footnote-ref'] === true;
17
- }
14
+ export default function MDXA(props: Props): ReactNode {
15
+ // MDX Footnotes have ids such as <a id="user-content-fn-1-953011" ...>
16
+ const anchorTargetClassName = useAnchorTargetClassName(props.id);
18
17
 
19
- function FootnoteRefLink(props: Props) {
20
- const {
21
- navbar: {hideOnScroll},
22
- } = useThemeConfig();
23
18
  return (
24
- <Link
25
- {...props}
26
- className={clsx(
27
- hideOnScroll
28
- ? styles.footnoteRefHideOnScrollNavbar
29
- : styles.footnoteRefStickyNavbar,
30
-
31
- props.className,
32
- )}
33
- />
19
+ <Link {...props} className={clsx(anchorTargetClassName, props.className)} />
34
20
  );
35
21
  }
36
-
37
- export default function MDXA(props: Props): ReactNode {
38
- if (isFootnoteRef(props)) {
39
- return <FootnoteRefLink {...props} />;
40
- }
41
- return <Link {...props} />;
42
- }
@@ -6,12 +6,17 @@
6
6
  */
7
7
 
8
8
  import React, {type ReactNode} from 'react';
9
+ import clsx from 'clsx';
9
10
  import useBrokenLinks from '@docusaurus/useBrokenLinks';
11
+ import {useAnchorTargetClassName} from '@docusaurus/theme-common';
10
12
  import type {Props} from '@theme/MDXComponents/Li';
11
13
 
12
14
  export default function MDXLi(props: Props): ReactNode | undefined {
13
15
  // MDX Footnotes have ids such as <li id="user-content-fn-1-953011">
14
16
  useBrokenLinks().collectAnchor(props.id);
17
+ const anchorTargetClassName = useAnchorTargetClassName(props.id);
15
18
 
16
- return <li {...props} />;
19
+ return (
20
+ <li className={clsx(anchorTargetClassName, props.className)} {...props} />
21
+ );
17
22
  }
@@ -1,20 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- /*
9
- When the navbar is sticky, ensure that on footnote click,
10
- the browser does not scroll to the ref behind the navbar
11
- See https://github.com/facebook/docusaurus/issues/11232
12
- See also headings case https://x.com/JoshWComeau/status/1332015868725891076
13
- */
14
- .footnoteRefStickyNavbar {
15
- scroll-margin-top: calc(var(--ifm-navbar-height) + 0.5rem);
16
- }
17
-
18
- .footnoteRefHideOnScrollNavbar {
19
- scroll-margin-top: 0.5rem;
20
- }
@@ -1,20 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- /*
9
- When the navbar is sticky, ensure that on footnote click,
10
- the browser does not scroll to the ref behind the navbar
11
- See https://github.com/facebook/docusaurus/issues/11232
12
- See also headings case https://x.com/JoshWComeau/status/1332015868725891076
13
- */
14
- .footnoteRefStickyNavbar {
15
- scroll-margin-top: calc(var(--ifm-navbar-height) + 0.5rem);
16
- }
17
-
18
- .footnoteRefHideOnScrollNavbar {
19
- scroll-margin-top: 0.5rem;
20
- }