@brillout/docpress 0.16.26 → 0.16.27
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.
package/components/Link.tsx
CHANGED
|
@@ -16,6 +16,7 @@ function Link({
|
|
|
16
16
|
doNotInferSectionTitle,
|
|
17
17
|
noWarning,
|
|
18
18
|
children,
|
|
19
|
+
...props
|
|
19
20
|
}: {
|
|
20
21
|
href: string
|
|
21
22
|
text?: string | React.ReactNode
|
|
@@ -23,7 +24,7 @@ function Link({
|
|
|
23
24
|
doNotInferSectionTitle?: boolean
|
|
24
25
|
noWarning?: boolean
|
|
25
26
|
children?: React.ReactNode
|
|
26
|
-
}) {
|
|
27
|
+
} & React.AnchorHTMLAttributes<HTMLAnchorElement>) {
|
|
27
28
|
const pageContext = usePageContext()
|
|
28
29
|
assertUsage(
|
|
29
30
|
href.startsWith('/') || href.startsWith('#'),
|
|
@@ -45,7 +46,11 @@ function Link({
|
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
|
|
48
|
-
return
|
|
49
|
+
return (
|
|
50
|
+
<a {...props} href={href}>
|
|
51
|
+
{text}
|
|
52
|
+
</a>
|
|
53
|
+
)
|
|
49
54
|
}
|
|
50
55
|
|
|
51
56
|
function getLinkText({
|
|
@@ -2,14 +2,14 @@ export { Link };
|
|
|
2
2
|
export type { LinkData };
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import type { StringArray } from '../types/Heading.js';
|
|
5
|
-
declare function Link({ href, text, noBreadcrumb, doNotInferSectionTitle, noWarning, children, }: {
|
|
5
|
+
declare function Link({ href, text, noBreadcrumb, doNotInferSectionTitle, noWarning, children, ...props }: {
|
|
6
6
|
href: string;
|
|
7
7
|
text?: string | React.ReactNode;
|
|
8
8
|
noBreadcrumb?: boolean;
|
|
9
9
|
doNotInferSectionTitle?: boolean;
|
|
10
10
|
noWarning?: boolean;
|
|
11
11
|
children?: React.ReactNode;
|
|
12
|
-
}): React.JSX.Element;
|
|
12
|
+
} & React.AnchorHTMLAttributes<HTMLAnchorElement>): React.JSX.Element;
|
|
13
13
|
type LinkData = {
|
|
14
14
|
url?: null | string;
|
|
15
15
|
title: string;
|
package/dist/components/Link.js
CHANGED
|
@@ -4,7 +4,7 @@ import { usePageContext } from '../renderer/usePageContext.js';
|
|
|
4
4
|
import { assert, assertUsage, assertWarning, determineSectionTitle, determineSectionUrlHash } from '../utils/server.js';
|
|
5
5
|
import { parseMarkdownMini } from '../parseMarkdownMini.js';
|
|
6
6
|
import pc from '@brillout/picocolors';
|
|
7
|
-
function Link({ href, text, noBreadcrumb, doNotInferSectionTitle, noWarning, children, }) {
|
|
7
|
+
function Link({ href, text, noBreadcrumb, doNotInferSectionTitle, noWarning, children, ...props }) {
|
|
8
8
|
const pageContext = usePageContext();
|
|
9
9
|
assertUsage(href.startsWith('/') || href.startsWith('#'), `<Link href /> prop \`href==='${href}'\` but should start with '/' or '#'`);
|
|
10
10
|
assertUsage(!text || !children, 'Cannot use both `text` or `children`');
|
|
@@ -22,7 +22,7 @@ function Link({ href, text, noBreadcrumb, doNotInferSectionTitle, noWarning, chi
|
|
|
22
22
|
text = 'LINK-TARGET-NOT-FOUND';
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
return React.createElement("a", { href: href }, text);
|
|
25
|
+
return (React.createElement("a", { ...props, href: href }, text));
|
|
26
26
|
}
|
|
27
27
|
function getLinkText({ noBreadcrumb, linkData, sectionTitle, isLinkOnSamePage, }) {
|
|
28
28
|
const breadcrumbParts = [];
|