@netfoundry/docusaurus-theme 0.1.2 → 0.1.4
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/README.md +146 -0
- package/css/legacy.css +4 -3
- package/dist/src/components/Alert/Alert.d.ts +9 -0
- package/dist/src/components/Alert/Alert.d.ts.map +1 -0
- package/dist/src/components/Alert/Alert.js +7 -0
- package/dist/src/components/Alert/Alert.js.map +1 -0
- package/{src/components/Alert/index.ts → dist/src/components/Alert/index.d.ts} +1 -0
- package/dist/src/components/Alert/index.d.ts.map +1 -0
- package/dist/src/components/Alert/index.js +2 -0
- package/dist/src/components/Alert/index.js.map +1 -0
- package/dist/src/components/CodeBlock/CodeBlock.d.ts +10 -0
- package/dist/src/components/CodeBlock/CodeBlock.d.ts.map +1 -0
- package/dist/src/components/CodeBlock/CodeBlock.js +8 -0
- package/dist/src/components/CodeBlock/CodeBlock.js.map +1 -0
- package/{src/components/CodeBlock/index.ts → dist/src/components/CodeBlock/index.d.ts} +1 -0
- package/dist/src/components/CodeBlock/index.d.ts.map +1 -0
- package/dist/src/components/CodeBlock/index.js +2 -0
- package/dist/src/components/CodeBlock/index.js.map +1 -0
- package/dist/src/components/Common/Common.d.ts +24 -0
- package/dist/src/components/Common/Common.d.ts.map +1 -0
- package/dist/src/components/Common/Common.js +20 -0
- package/dist/src/components/Common/Common.js.map +1 -0
- package/dist/src/components/Common/index.d.ts +2 -0
- package/dist/src/components/Common/index.d.ts.map +1 -0
- package/dist/src/components/Common/index.js +2 -0
- package/dist/src/components/Common/index.js.map +1 -0
- package/dist/src/components/NetFoundry/Divider/Divider.d.ts +3 -0
- package/dist/src/components/NetFoundry/Divider/Divider.d.ts.map +1 -0
- package/dist/src/components/NetFoundry/Divider/Divider.js +6 -0
- package/dist/src/components/NetFoundry/Divider/Divider.js.map +1 -0
- package/dist/src/components/NetFoundry/Divider/index.d.ts +2 -0
- package/dist/src/components/NetFoundry/Divider/index.d.ts.map +1 -0
- package/dist/src/components/NetFoundry/Divider/index.js +2 -0
- package/dist/src/components/NetFoundry/Divider/index.js.map +1 -0
- package/dist/src/components/NetFoundry/index.d.ts +2 -0
- package/dist/src/components/NetFoundry/index.d.ts.map +1 -0
- package/dist/src/components/NetFoundry/index.js +2 -0
- package/dist/src/components/NetFoundry/index.js.map +1 -0
- package/dist/src/components/NetFoundryFooter/NetFoundryFooter.d.ts +23 -0
- package/dist/src/components/NetFoundryFooter/NetFoundryFooter.d.ts.map +1 -0
- package/dist/src/components/NetFoundryFooter/NetFoundryFooter.js +63 -0
- package/dist/src/components/NetFoundryFooter/NetFoundryFooter.js.map +1 -0
- package/dist/src/components/NetFoundryFooter/index.d.ts +2 -0
- package/dist/src/components/NetFoundryFooter/index.d.ts.map +1 -0
- package/{src/components/NetFoundryFooter/index.ts → dist/src/components/NetFoundryFooter/index.js} +2 -1
- package/dist/src/components/NetFoundryFooter/index.js.map +1 -0
- package/dist/src/components/NetFoundryHighlight/NetFoundryHighlight.d.ts +7 -0
- package/dist/src/components/NetFoundryHighlight/NetFoundryHighlight.d.ts.map +1 -0
- package/dist/src/components/NetFoundryHighlight/NetFoundryHighlight.js +6 -0
- package/dist/src/components/NetFoundryHighlight/NetFoundryHighlight.js.map +1 -0
- package/{src/components/NetFoundryHighlight/index.ts → dist/src/components/NetFoundryHighlight/index.d.ts} +3 -2
- package/dist/src/components/NetFoundryHighlight/index.d.ts.map +1 -0
- package/dist/src/components/NetFoundryHighlight/index.js +2 -0
- package/dist/src/components/NetFoundryHighlight/index.js.map +1 -0
- package/dist/src/components/NetFoundryHorizontalSection/NetFoundryHorizontalSection.d.ts +9 -0
- package/dist/src/components/NetFoundryHorizontalSection/NetFoundryHorizontalSection.d.ts.map +1 -0
- package/dist/src/components/NetFoundryHorizontalSection/NetFoundryHorizontalSection.js +8 -0
- package/dist/src/components/NetFoundryHorizontalSection/NetFoundryHorizontalSection.js.map +1 -0
- package/dist/src/components/NetFoundryHorizontalSection/index.d.ts +3 -0
- package/dist/src/components/NetFoundryHorizontalSection/index.d.ts.map +1 -0
- package/dist/src/components/NetFoundryHorizontalSection/index.js +2 -0
- package/dist/src/components/NetFoundryHorizontalSection/index.js.map +1 -0
- package/dist/src/components/NetFoundryLayout/NetFoundryLayout.d.ts +30 -0
- package/dist/src/components/NetFoundryLayout/NetFoundryLayout.d.ts.map +1 -0
- package/dist/src/components/NetFoundryLayout/NetFoundryLayout.js +35 -0
- package/dist/src/components/NetFoundryLayout/NetFoundryLayout.js.map +1 -0
- package/dist/src/components/NetFoundryLayout/index.d.ts +2 -0
- package/dist/src/components/NetFoundryLayout/index.d.ts.map +1 -0
- package/dist/src/components/NetFoundryLayout/index.js +2 -0
- package/dist/src/components/NetFoundryLayout/index.js.map +1 -0
- package/dist/src/components/NetFoundryNavbarItems/NetFoundryNavbarItems.d.ts +10 -0
- package/dist/src/components/NetFoundryNavbarItems/NetFoundryNavbarItems.d.ts.map +1 -0
- package/{src/components/NetFoundryNavbarItems/NetFoundryNavbarItems.tsx → dist/src/components/NetFoundryNavbarItems/NetFoundryNavbarItems.js} +14 -22
- package/dist/src/components/NetFoundryNavbarItems/NetFoundryNavbarItems.js.map +1 -0
- package/dist/src/components/NetFoundryNavbarItems/index.d.ts +3 -0
- package/dist/src/components/NetFoundryNavbarItems/index.d.ts.map +1 -0
- package/dist/src/components/NetFoundryNavbarItems/index.js +2 -0
- package/dist/src/components/NetFoundryNavbarItems/index.js.map +1 -0
- package/dist/src/components/OsTabs/OsTabs.d.ts +6 -0
- package/dist/src/components/OsTabs/OsTabs.d.ts.map +1 -0
- package/dist/src/components/OsTabs/OsTabs.js +18 -0
- package/dist/src/components/OsTabs/OsTabs.js.map +1 -0
- package/dist/src/components/OsTabs/index.d.ts +3 -0
- package/dist/src/components/OsTabs/index.d.ts.map +1 -0
- package/dist/src/components/OsTabs/index.js +2 -0
- package/dist/src/components/OsTabs/index.js.map +1 -0
- package/dist/src/components/StarUs/StarUs.d.ts +7 -0
- package/dist/src/components/StarUs/StarUs.d.ts.map +1 -0
- package/dist/src/components/StarUs/StarUs.js +7 -0
- package/dist/src/components/StarUs/StarUs.js.map +1 -0
- package/dist/src/components/StarUs/index.d.ts +3 -0
- package/dist/src/components/StarUs/index.d.ts.map +1 -0
- package/{src/components/StarUs/index.ts → dist/src/components/StarUs/index.js} +1 -1
- package/dist/src/components/StarUs/index.js.map +1 -0
- package/dist/src/components/index.d.ts +12 -0
- package/dist/src/components/index.d.ts.map +1 -0
- package/{src/components/index.ts → dist/src/components/index.js} +3 -2
- package/dist/src/components/index.js.map +1 -0
- package/dist/src/docusaurus-envhelper.d.ts +16 -0
- package/dist/src/docusaurus-envhelper.d.ts.map +1 -0
- package/{src/docusaurus-envhelper.ts → dist/src/docusaurus-envhelper.js} +66 -98
- package/dist/src/docusaurus-envhelper.js.map +1 -0
- package/dist/src/docusaurus-plugins/index.d.ts +8 -0
- package/dist/src/docusaurus-plugins/index.d.ts.map +1 -0
- package/dist/src/docusaurus-plugins/index.js +8 -0
- package/dist/src/docusaurus-plugins/index.js.map +1 -0
- package/dist/src/docusaurus-plugins/logger.d.ts +13 -0
- package/dist/src/docusaurus-plugins/logger.d.ts.map +1 -0
- package/dist/src/docusaurus-plugins/logger.js +41 -0
- package/dist/src/docusaurus-plugins/logger.js.map +1 -0
- package/dist/src/docusaurus-plugins/remarkCodeSections.d.ts +8 -0
- package/dist/src/docusaurus-plugins/remarkCodeSections.d.ts.map +1 -0
- package/dist/src/docusaurus-plugins/remarkCodeSections.js +96 -0
- package/dist/src/docusaurus-plugins/remarkCodeSections.js.map +1 -0
- package/dist/src/docusaurus-plugins/remarkReplaceMetaUrl.d.ts +11 -0
- package/dist/src/docusaurus-plugins/remarkReplaceMetaUrl.d.ts.map +1 -0
- package/dist/src/docusaurus-plugins/remarkReplaceMetaUrl.js +23 -0
- package/dist/src/docusaurus-plugins/remarkReplaceMetaUrl.js.map +1 -0
- package/dist/src/docusaurus-plugins/remarkScopedPath.d.ts +13 -0
- package/dist/src/docusaurus-plugins/remarkScopedPath.d.ts.map +1 -0
- package/dist/src/docusaurus-plugins/remarkScopedPath.js +48 -0
- package/dist/src/docusaurus-plugins/remarkScopedPath.js.map +1 -0
- package/dist/src/docusaurus-plugins/remarkYamlTable.d.ts +8 -0
- package/dist/src/docusaurus-plugins/remarkYamlTable.d.ts.map +1 -0
- package/dist/src/docusaurus-plugins/remarkYamlTable.js +50 -0
- package/dist/src/docusaurus-plugins/remarkYamlTable.js.map +1 -0
- package/dist/src/docusaurus-plugins/remarkYouTube.d.ts +8 -0
- package/dist/src/docusaurus-plugins/remarkYouTube.d.ts.map +1 -0
- package/dist/src/docusaurus-plugins/remarkYouTube.js +44 -0
- package/dist/src/docusaurus-plugins/remarkYouTube.js.map +1 -0
- package/dist/src/docusaurus-plugins/timedPlugin.d.ts +6 -0
- package/dist/src/docusaurus-plugins/timedPlugin.d.ts.map +1 -0
- package/dist/src/docusaurus-plugins/timedPlugin.js +16 -0
- package/dist/src/docusaurus-plugins/timedPlugin.js.map +1 -0
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +32 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/node.d.ts +7 -0
- package/dist/src/node.d.ts.map +1 -0
- package/{src/node.ts → dist/src/node.js} +7 -6
- package/dist/src/node.js.map +1 -0
- package/{src/options.ts → dist/src/options.d.ts} +90 -95
- package/dist/src/options.d.ts.map +1 -0
- package/dist/src/options.js +2 -0
- package/dist/src/options.js.map +1 -0
- package/dist/src/plugins.d.ts +7 -0
- package/dist/src/plugins.d.ts.map +1 -0
- package/{src/plugins.ts → dist/src/plugins.js} +7 -6
- package/dist/src/plugins.js.map +1 -0
- package/dist/src/ui.d.ts +8 -0
- package/dist/src/ui.d.ts.map +1 -0
- package/{src/ui.ts → dist/src/ui.js} +8 -7
- package/dist/src/ui.js.map +1 -0
- package/dist/src/version.d.ts +2 -0
- package/dist/src/version.d.ts.map +1 -0
- package/dist/src/version.js +2 -0
- package/dist/src/version.js.map +1 -0
- package/dist/theme/Layout/index.d.ts +19 -0
- package/dist/theme/Layout/index.d.ts.map +1 -0
- package/dist/theme/Layout/index.js +39 -0
- package/dist/theme/Layout/index.js.map +1 -0
- package/package.json +24 -16
- package/src/components/Alert/Alert.tsx +0 -24
- package/src/components/CodeBlock/CodeBlock.tsx +0 -32
- package/src/components/Common/Common.tsx +0 -53
- package/src/components/Common/index.ts +0 -1
- package/src/components/NetFoundry/Divider/Divider.tsx +0 -20
- package/src/components/NetFoundry/Divider/index.ts +0 -1
- package/src/components/NetFoundry/index.ts +0 -1
- package/src/components/NetFoundryFooter/NetFoundryFooter.tsx +0 -164
- package/src/components/NetFoundryHighlight/NetFoundryHighlight.tsx +0 -15
- package/src/components/NetFoundryHorizontalSection/NetFoundryHorizontalSection.tsx +0 -23
- package/src/components/NetFoundryHorizontalSection/index.ts +0 -2
- package/src/components/NetFoundryLayout/NetFoundryLayout.tsx +0 -110
- package/src/components/NetFoundryLayout/index.ts +0 -1
- package/src/components/NetFoundryNavbarItems/index.ts +0 -2
- package/src/components/OsTabs/OsTabs.tsx +0 -30
- package/src/components/OsTabs/index.ts +0 -2
- package/src/components/StarUs/StarUs.tsx +0 -19
- package/src/docusaurus-plugins/index.ts +0 -7
- package/src/docusaurus-plugins/logger.ts +0 -38
- package/src/docusaurus-plugins/remarkCodeSections.ts +0 -115
- package/src/docusaurus-plugins/remarkReplaceMetaUrl.ts +0 -35
- package/src/docusaurus-plugins/remarkScopedPath.ts +0 -70
- package/src/docusaurus-plugins/remarkYamlTable.ts +0 -83
- package/src/docusaurus-plugins/remarkYouTube.ts +0 -56
- package/src/docusaurus-plugins/timedPlugin.ts +0 -22
- package/src/index.ts +0 -46
- package/src/version.ts +0 -1
- package/theme/Layout/index.tsx +0 -74
- /package/{src → dist/src}/components/Alert/Alert.module.css +0 -0
- /package/{src → dist/src}/components/CodeBlock/CodeBlock.module.css +0 -0
- /package/{src → dist/src}/components/Common/Common.module.css +0 -0
- /package/{src → dist/src}/components/NetFoundry/Divider/Divider.module.css +0 -0
- /package/{src → dist/src}/components/NetFoundryFooter/styles.module.css +0 -0
- /package/{src → dist/src}/components/NetFoundryHighlight/styles.module.css +0 -0
- /package/{src → dist/src}/components/NetFoundryHorizontalSection/styles.module.css +0 -0
- /package/{src → dist/src}/components/NetFoundryLayout/NetFoundryLayout.module.css +0 -0
- /package/{src → dist/src}/components/StarUs/styles.module.css +0 -0
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import React, {CSSProperties, ReactNode} from 'react';
|
|
2
|
-
import clsx from 'clsx';
|
|
3
|
-
import {NetFoundryHorizontalSection} from "../NetFoundryHorizontalSection";
|
|
4
|
-
import useBaseUrl from "@docusaurus/useBaseUrl";
|
|
5
|
-
import styles from './styles.module.css';
|
|
6
|
-
|
|
7
|
-
export interface SocialProps {
|
|
8
|
-
twitterUrl?: string;
|
|
9
|
-
linkedInUrl?: string;
|
|
10
|
-
githubUrl?: string;
|
|
11
|
-
facebookUrl?: string;
|
|
12
|
-
instagramUrl?: string;
|
|
13
|
-
youtubeUrl?: string;
|
|
14
|
-
}
|
|
15
|
-
export const defaultSocialProps: SocialProps = {
|
|
16
|
-
twitterUrl: '',
|
|
17
|
-
linkedInUrl: '',
|
|
18
|
-
githubUrl: '',
|
|
19
|
-
facebookUrl: '',
|
|
20
|
-
instagramUrl: '',
|
|
21
|
-
youtubeUrl: '',
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export type NetFoundryFooterProps = {
|
|
25
|
-
className?: string;
|
|
26
|
-
style?: CSSProperties;
|
|
27
|
-
description?: string;
|
|
28
|
-
socialProps?: SocialProps;
|
|
29
|
-
documentationLinks?: React.ReactNode[];
|
|
30
|
-
communityLinks?: React.ReactNode[];
|
|
31
|
-
resourceLinks?: React.ReactNode[];
|
|
32
|
-
children?: ReactNode;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export function defaultNetFoundryFooterProps(overrides?: Partial<NetFoundryFooterProps>): NetFoundryFooterProps {
|
|
36
|
-
return {
|
|
37
|
-
description: 'Self-hosted OpenZiti for enterprises needing compliance, control, and support.',
|
|
38
|
-
socialProps: {
|
|
39
|
-
githubUrl: 'https://github.com/openziti/ziti',
|
|
40
|
-
linkedInUrl: 'https://www.linkedin.com/company/netfoundry',
|
|
41
|
-
youtubeUrl: 'https://www.youtube.com/OpenZiti',
|
|
42
|
-
twitterUrl: 'https://x.com/OpenZiti'
|
|
43
|
-
},
|
|
44
|
-
documentationLinks: [
|
|
45
|
-
<a href="/docs/openziti/learn/quickstarts/services/ztha">Getting Started</a>,
|
|
46
|
-
<a href="/docs/openziti/reference/developer/api/">API Reference</a>,
|
|
47
|
-
<a href="/docs/openziti/reference/developer/sdk/">SDK Integration</a>,
|
|
48
|
-
],
|
|
49
|
-
communityLinks: [
|
|
50
|
-
<a href="https://github.com/openziti/ziti">GitHub</a>,
|
|
51
|
-
<a href="https://openziti.discourse.group/">Discourse Forum</a>,
|
|
52
|
-
<a href="/docs/openziti/policies/CONTRIBUTING">Contributing</a>,
|
|
53
|
-
],
|
|
54
|
-
resourceLinks: [
|
|
55
|
-
<a href="https://blog.openziti.io">OpenZiti Tech Blog</a>,
|
|
56
|
-
<a href="https://netfoundry.io/">NetFoundry</a>,
|
|
57
|
-
],
|
|
58
|
-
...overrides
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function ListBlock({title, items}:{title:string; items?: React.ReactNode[]}) {
|
|
63
|
-
if (!items?.length) return null;
|
|
64
|
-
return (
|
|
65
|
-
<div className={styles.footerColumn}>
|
|
66
|
-
<h3>{title}</h3>
|
|
67
|
-
<ul className={styles.footerLinks}>
|
|
68
|
-
{items.map((item, i) => <li key={i}>{item}</li>)}
|
|
69
|
-
</ul>
|
|
70
|
-
</div>
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export function NetFoundryFooter(props: NetFoundryFooterProps) {
|
|
75
|
-
const { className, style, children, description } = props;
|
|
76
|
-
const sp = {...defaultSocialProps, ...(props.socialProps ?? {})};
|
|
77
|
-
|
|
78
|
-
if (children) return <>{children}</>;
|
|
79
|
-
|
|
80
|
-
return (
|
|
81
|
-
<footer className={clsx(className, styles.ozFooter)} style={style}>
|
|
82
|
-
<NetFoundryHorizontalSection className={styles.footer}>
|
|
83
|
-
<div className={styles.footerContainer}>
|
|
84
|
-
<div className={styles.footerGrid}>
|
|
85
|
-
<div className={styles.footerColumn}>
|
|
86
|
-
<h3>NetFoundry</h3>
|
|
87
|
-
<p>{description ?? 'An open source project enabling developers to embed zero trust networking directly into applications.'}</p>
|
|
88
|
-
<div className={styles.footerSocialLinks}>
|
|
89
|
-
{sp.githubUrl && (
|
|
90
|
-
<a href={sp.githubUrl} target="_blank" className={styles.footerSocialLink} rel="noreferrer">
|
|
91
|
-
<svg width="20" height="20" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
|
|
92
|
-
<path d="M8 0C3.58 0 0 3.58 0 8C0 11.54 2.29 14.53 5.47 15.59C5.87 15.66 6.02 15.42 6.02 15.21C6.02 15.02 6.01 14.39 6.01 13.72C4 14.09 3.48 13.23 3.32 12.78C3.23 12.55 2.84 11.84 2.5 11.65C2.22 11.5 1.82 11.13 2.49 11.12C3.12 11.11 3.57 11.7 3.72 11.94C4.44 13.15 5.59 12.81 6.05 12.6C6.12 12.08 6.33 11.73 6.56 11.53C4.78 11.33 2.92 10.64 2.92 7.58C2.92 6.71 3.23 5.99 3.74 5.43C3.66 5.23 3.38 4.41 3.82 3.31C3.82 3.31 4.49 3.1 6.02 4.13C6.66 3.95 7.34 3.86 8.02 3.86C8.7 3.86 9.38 3.95 10.02 4.13C11.55 3.09 12.22 3.31 12.22 3.31C12.66 4.41 12.38 5.23 12.3 5.43C12.81 5.99 13.12 6.7 13.12 7.58C13.12 10.65 11.25 11.33 9.47 11.53C9.76 11.78 10.01 12.26 10.01 13.01C10.01 14.08 10 14.94 10 15.21C10 15.42 10.15 15.67 10.55 15.59C13.71 14.53 16 11.53 16 8C16 3.58 12.42 0 8 0Z"/>
|
|
93
|
-
</svg>
|
|
94
|
-
</a>
|
|
95
|
-
)}
|
|
96
|
-
{sp.linkedInUrl && (
|
|
97
|
-
<a href={sp.linkedInUrl} target="_blank" className={styles.footerSocialLink} rel="noreferrer">
|
|
98
|
-
<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
|
|
99
|
-
<path d="M15.996 16V10.1C15.996 7.5 15.375 5.49999 12.025 5.49999C10.4 5.49999 9.325 6.39999 8.875 7.29999H8.825V5.79999H5.65V16H8.95V10.7C8.95 9.30001 9.2 7.9 10.925 7.9C12.65 7.9 12.675 9.59999 12.675 10.8V16H15.996Z"/>
|
|
100
|
-
<path d="M0.25 5.79999H3.575V16H0.25V5.79999Z"/>
|
|
101
|
-
<path d="M1.9 0C0.85 0 0 0.85 0 1.9C0 2.95 0.85 3.8 1.9 3.8C2.95 3.8 3.8 2.95 3.8 1.9C3.8 0.85 2.95 0 1.9 0Z"/>
|
|
102
|
-
</svg>
|
|
103
|
-
</a>
|
|
104
|
-
)}
|
|
105
|
-
{sp.youtubeUrl && (
|
|
106
|
-
<a href={sp.youtubeUrl} target="_blank" className={styles.footerSocialLink} rel="noreferrer">
|
|
107
|
-
<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
|
|
108
|
-
<path d="M15.969 4.69c-.183-1.358-1.062-2.275-2.361-2.46C12.371 2 8 2 8 2S3.629 2 2.362 2.229c-1.3.186-2.179 1.103-2.361 2.461C0 6.03 0 10 0 10s0 3.97.2 5.31c.183 1.358 1.062 2.275 2.361 2.46C3.63 18 8 18 8 18s4.371 0 5.638-.23c1.3-.185 2.178-1.102 2.361-2.46.2-1.34.2-5.31.2-5.31s0-3.97-.23-5.31zm-8.36, 8.57V6.73l3.76 2.27-3.76 2.26z"/>
|
|
109
|
-
</svg>
|
|
110
|
-
</a>
|
|
111
|
-
)}
|
|
112
|
-
{sp.twitterUrl && (
|
|
113
|
-
<a href={sp.twitterUrl} target="_blank" className={styles.footerSocialLink} rel="noreferrer">
|
|
114
|
-
<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
|
|
115
|
-
<path d="M15.996 3.038c-.59.262-1.219.44-1.885.52.677-.406 1.194-1.05 1.438-1.815-.634.375-1.337.648-2.085.795-.598-.638-1.45-1.038-2.396-1.038-1.813 0-3.283 1.469-3.283 3.282 0 .257.03.507.085.748-2.728-.137-5.147-1.445-6.766-3.43-.282.485-.444 1.05-.444 1.651 0 1.14.58 2.143 1.46 2.732-.538-.017-1.044-.164-1.487-.41v.04c0 1.59 1.13 2.918 2.633 3.219-.276.075-.567.116-.866.116-.211 0-.416-.021-.617-.06.418 1.304 1.63 2.254 3.066 2.28-1.124.883-2.539 1.406-4.077 1.406-.265 0-.526-.015-.785-.046 1.453.933 3.178 1.475 5.032 1.475 6.038 0 9.34-5.002 9.34-9.34 0-.142-.004-.284-.01-.425.641-.463 1.198-1.039 1.638-1.696"/>
|
|
116
|
-
</svg>
|
|
117
|
-
</a>
|
|
118
|
-
)}
|
|
119
|
-
{sp.facebookUrl && (
|
|
120
|
-
<a href={sp.facebookUrl} target="_blank" className={styles.footerSocialLink} rel="noreferrer">
|
|
121
|
-
<span>f</span>
|
|
122
|
-
</a>
|
|
123
|
-
)}
|
|
124
|
-
{sp.instagramUrl && (
|
|
125
|
-
<a href={sp.instagramUrl} target="_blank" className={styles.footerSocialLink} rel="noreferrer">
|
|
126
|
-
<span>ig</span>
|
|
127
|
-
</a>
|
|
128
|
-
)}
|
|
129
|
-
</div>
|
|
130
|
-
</div>
|
|
131
|
-
|
|
132
|
-
<ListBlock
|
|
133
|
-
title="Documentation"
|
|
134
|
-
items={props.documentationLinks ?? [
|
|
135
|
-
<a href={useBaseUrl("/docs/learn/quickstarts/services/ztha")}>Getting Started</a>,
|
|
136
|
-
<a href={useBaseUrl("/docs/reference/developer/api/")}>API Reference</a>,
|
|
137
|
-
<a href={useBaseUrl("/docs/reference/developer/sdk/")}>SDK Integration</a>,
|
|
138
|
-
]}
|
|
139
|
-
/>
|
|
140
|
-
<ListBlock
|
|
141
|
-
title="Community"
|
|
142
|
-
items={props.communityLinks ?? [
|
|
143
|
-
<a href="https://github.com/openziti/ziti">GitHub</a>,
|
|
144
|
-
<a href="https://openziti.discourse.group/">Discourse Forum</a>,
|
|
145
|
-
<a href="/docs/openziti/policies/CONTRIBUTING">Contributing</a>,
|
|
146
|
-
]}
|
|
147
|
-
/>
|
|
148
|
-
<ListBlock
|
|
149
|
-
title="Resources"
|
|
150
|
-
items={props.resourceLinks ?? [
|
|
151
|
-
<a href="https://blog.openziti.io">OpenZiti Tech Blog</a>,
|
|
152
|
-
<a href="https://netfoundry.io/">NetFoundry</a>,
|
|
153
|
-
]}
|
|
154
|
-
/>
|
|
155
|
-
</div>
|
|
156
|
-
</div>
|
|
157
|
-
|
|
158
|
-
<div className={styles.footerCopyright}>
|
|
159
|
-
<p>© 2025 NetFoundry Inc. OpenZiti is an open source project sponsored by NetFoundry. All rights reserved.</p>
|
|
160
|
-
</div>
|
|
161
|
-
</NetFoundryHorizontalSection>
|
|
162
|
-
</footer>
|
|
163
|
-
);
|
|
164
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode, CSSProperties } from 'react';
|
|
2
|
-
|
|
3
|
-
export type NetFoundryHighlightProps = {
|
|
4
|
-
children?: ReactNode;
|
|
5
|
-
style?: CSSProperties;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export function NetFoundryHighlight(props: NetFoundryHighlightProps) {
|
|
9
|
-
const { children, style } = props;
|
|
10
|
-
return (
|
|
11
|
-
<span style={style}>
|
|
12
|
-
<span style={{ color: 'var(--ifm-color-primary)' }}>{children}</span>
|
|
13
|
-
</span>
|
|
14
|
-
);
|
|
15
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode, CSSProperties } from 'react';
|
|
2
|
-
import clsx from 'clsx';
|
|
3
|
-
import styles from './styles.module.css';
|
|
4
|
-
|
|
5
|
-
export type NetFoundryHorizontalSectionProps = {
|
|
6
|
-
children?: ReactNode;
|
|
7
|
-
className?: string;
|
|
8
|
-
style?: CSSProperties;
|
|
9
|
-
id?: string;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export function NetFoundryHorizontalSection(props: NetFoundryHorizontalSectionProps) {
|
|
13
|
-
const { children, className, style, id } = props;
|
|
14
|
-
return (
|
|
15
|
-
<section
|
|
16
|
-
className={clsx(className, styles.ozHorizontalSectionRoot, styles.ozhsContent)}
|
|
17
|
-
style={style}
|
|
18
|
-
id={id}
|
|
19
|
-
>
|
|
20
|
-
{children}
|
|
21
|
-
</section>
|
|
22
|
-
);
|
|
23
|
-
}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import React, {JSX} from "react";
|
|
2
|
-
import clsx from "clsx";
|
|
3
|
-
import ErrorBoundary from "@docusaurus/ErrorBoundary";
|
|
4
|
-
import { ThemeClassNames } from "@docusaurus/theme-common";
|
|
5
|
-
// @ts-ignore
|
|
6
|
-
import { useKeyboardNavigation } from "@docusaurus/theme-common/internal";
|
|
7
|
-
import Head from "@docusaurus/Head";
|
|
8
|
-
import useBaseUrl from "@docusaurus/useBaseUrl";
|
|
9
|
-
|
|
10
|
-
import SkipToContent from "@theme/SkipToContent";
|
|
11
|
-
import AnnouncementBar from "@theme/AnnouncementBar";
|
|
12
|
-
import Navbar from "@theme/Navbar";
|
|
13
|
-
import LayoutProvider from "@theme/Layout/Provider";
|
|
14
|
-
import ErrorPageContent from "@theme/ErrorPageContent";
|
|
15
|
-
import styles from "./NetFoundryLayout.module.css";
|
|
16
|
-
|
|
17
|
-
import { NetFoundryFooter, NetFoundryFooterProps } from "../NetFoundryFooter";
|
|
18
|
-
import { StarUs, StarUsProps } from "../StarUs";
|
|
19
|
-
import { version } from '../../version';
|
|
20
|
-
|
|
21
|
-
export interface MetaProps {
|
|
22
|
-
title?: string;
|
|
23
|
-
description?: string;
|
|
24
|
-
url?: string;
|
|
25
|
-
image?: string;
|
|
26
|
-
siteName?: string;
|
|
27
|
-
locale?: string;
|
|
28
|
-
twitterX?: {
|
|
29
|
-
card?: "summary" | "summary_large_image" | "player" | "app";
|
|
30
|
-
site?: string;
|
|
31
|
-
creator?: string;
|
|
32
|
-
imageAlt?: string;
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface NetFoundryLayoutProps {
|
|
37
|
-
children: React.ReactNode;
|
|
38
|
-
noFooter?: boolean;
|
|
39
|
-
className?: string;
|
|
40
|
-
footerClassName?: string;
|
|
41
|
-
title?: string;
|
|
42
|
-
description?: string;
|
|
43
|
-
starProps?: StarUsProps;
|
|
44
|
-
footerProps?: NetFoundryFooterProps;
|
|
45
|
-
meta?: MetaProps;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function useAbs() {
|
|
49
|
-
return (p?: string) => {
|
|
50
|
-
if (!p) return undefined;
|
|
51
|
-
if (p.startsWith("http")) return p;
|
|
52
|
-
return new URL(useBaseUrl(p), window.location.origin).toString();
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export function NetFoundryLayout({
|
|
57
|
-
children,
|
|
58
|
-
noFooter,
|
|
59
|
-
className,
|
|
60
|
-
title,
|
|
61
|
-
description,
|
|
62
|
-
starProps = { repoUrl: "", label: "Star us on GitHub" },
|
|
63
|
-
footerProps,
|
|
64
|
-
meta: metaInput = {},
|
|
65
|
-
}: NetFoundryLayoutProps): JSX.Element {
|
|
66
|
-
useKeyboardNavigation();
|
|
67
|
-
|
|
68
|
-
const abs = useAbs();
|
|
69
|
-
const meta = metaInput;
|
|
70
|
-
const pageTitle =
|
|
71
|
-
(meta.title ?? title ?? "") +
|
|
72
|
-
(meta.siteName ? ` | ${meta.siteName}` : "");
|
|
73
|
-
|
|
74
|
-
return (
|
|
75
|
-
<LayoutProvider>
|
|
76
|
-
<Head>
|
|
77
|
-
<title>{pageTitle}</title>
|
|
78
|
-
<meta data-rh="true" name="nf-layout-version" content={version} />
|
|
79
|
-
{(meta.description ?? description) && (<meta name="description" content={meta.description ?? description} />)}
|
|
80
|
-
{meta.url && <meta property="og:url" content={meta.url} />}
|
|
81
|
-
{meta.siteName && <meta property="og:site_name" content={meta.siteName} />}
|
|
82
|
-
{meta.title && <meta property="og:title" content={meta.title} />}
|
|
83
|
-
{meta.description && (<meta property="og:description" content={meta.description} />)}
|
|
84
|
-
{meta.image && <meta property="og:image" content={abs(meta.image)} />}
|
|
85
|
-
{meta.locale && <meta property="og:locale" content={meta.locale} />}
|
|
86
|
-
<meta name="twitter:card" content={meta.twitterX?.card ?? "summary_large_image"} />
|
|
87
|
-
{meta.twitterX?.site && (<meta name="twitter:site" content={meta.twitterX.site} />)}
|
|
88
|
-
{meta.twitterX?.creator && (<meta name="twitter:creator" content={meta.twitterX.creator} />)}
|
|
89
|
-
{meta.image && (<meta name="twitter:image" content={abs(meta.image)} />)}
|
|
90
|
-
{meta.twitterX?.imageAlt && (<meta name="twitter:image:alt" content={meta.twitterX.imageAlt} />)}
|
|
91
|
-
</Head>
|
|
92
|
-
<SkipToContent />
|
|
93
|
-
<AnnouncementBar />
|
|
94
|
-
<Navbar />
|
|
95
|
-
{starProps.repoUrl && starProps.label && <StarUs {...starProps} />}
|
|
96
|
-
<div
|
|
97
|
-
className={clsx(
|
|
98
|
-
ThemeClassNames.wrapper.main,
|
|
99
|
-
styles.ozLayoutMainWrapper,
|
|
100
|
-
className,
|
|
101
|
-
)}
|
|
102
|
-
>
|
|
103
|
-
<ErrorBoundary fallback={<ErrorPageContent />}>
|
|
104
|
-
{children}
|
|
105
|
-
</ErrorBoundary>
|
|
106
|
-
{!noFooter && footerProps && <NetFoundryFooter {...footerProps} />}
|
|
107
|
-
</div>
|
|
108
|
-
</LayoutProvider>
|
|
109
|
-
);
|
|
110
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './NetFoundryLayout';
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React, {useState, useEffect, ReactNode, JSX} from 'react';
|
|
2
|
-
import OriginalTabs from '@theme/Tabs';
|
|
3
|
-
import { osName } from 'react-device-detect';
|
|
4
|
-
import type { ComponentProps } from 'react';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export type OsTabsProps = ComponentProps<typeof OriginalTabs>;
|
|
8
|
-
|
|
9
|
-
export function OsTabs(props: OsTabsProps): JSX.Element {
|
|
10
|
-
const [defaultValue, setDefaultValue] = useState<string | null>(null);
|
|
11
|
-
|
|
12
|
-
useEffect(() => {
|
|
13
|
-
const tabs = ['iOS', 'Android', 'Mac OS', 'Windows', 'Linux'];
|
|
14
|
-
if (tabs.includes(osName)) {
|
|
15
|
-
setDefaultValue(osName);
|
|
16
|
-
} else {
|
|
17
|
-
setDefaultValue('Windows');
|
|
18
|
-
}
|
|
19
|
-
}, []);
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<>
|
|
23
|
-
<OriginalTabs {...props} defaultValue={defaultValue}>
|
|
24
|
-
{props.children}
|
|
25
|
-
</OriginalTabs>
|
|
26
|
-
{/* Uncomment the following line to debug the detected and selected values */}
|
|
27
|
-
{/* <h2>detected={osName}, selected={defaultValue}</h2> */}
|
|
28
|
-
</>
|
|
29
|
-
);
|
|
30
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React, {ReactNode} from 'react';
|
|
2
|
-
import styles from './styles.module.css';
|
|
3
|
-
import GitHubButton from 'react-github-btn';
|
|
4
|
-
|
|
5
|
-
export type StarUsProps = {
|
|
6
|
-
repoUrl?: string;
|
|
7
|
-
label?: string;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export default function StarUs({repoUrl = '', label = ''}: StarUsProps): ReactNode {
|
|
11
|
-
return (
|
|
12
|
-
<div className={styles.starUsRoot}>
|
|
13
|
-
<span style={{color: "whitesmoke"}}>{label} </span>
|
|
14
|
-
<span style={{height: "20px"}}>
|
|
15
|
-
<GitHubButton href={repoUrl} data-icon="octicon-star" data-show-count="true" aria-label="Star buttons/github-buttons on GitHub">Star</GitHubButton>
|
|
16
|
-
</span>
|
|
17
|
-
</div>
|
|
18
|
-
);
|
|
19
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { writeFileSync, appendFileSync, existsSync } from 'fs'
|
|
2
|
-
import { join } from 'path'
|
|
3
|
-
|
|
4
|
-
export enum LogLevel {
|
|
5
|
-
Silent = 0,
|
|
6
|
-
Info = 1,
|
|
7
|
-
Debug = 2,
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const LOG = join(process.cwd(), 'remark-plugins.log')
|
|
11
|
-
|
|
12
|
-
export class Logger {
|
|
13
|
-
constructor(private level: LogLevel, private name: string) {}
|
|
14
|
-
log(msg: unknown, level: LogLevel = LogLevel.Info) {
|
|
15
|
-
if (this.level === LogLevel.Silent) return
|
|
16
|
-
if (level > this.level) return
|
|
17
|
-
|
|
18
|
-
const text = String(msg)
|
|
19
|
-
if (!text.trim()) return
|
|
20
|
-
|
|
21
|
-
const line = `[${this.name}] ${LogLevel[level]} ${text}`
|
|
22
|
-
if (!existsSync(LOG)) writeFileSync(LOG, '')
|
|
23
|
-
appendFileSync(LOG, `[${new Date().toISOString()}] ${line}\n`)
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function resolveLogLevel(val: unknown): LogLevel {
|
|
28
|
-
if (typeof val === "number" && LogLevel[val] !== undefined) {
|
|
29
|
-
return val as LogLevel
|
|
30
|
-
}
|
|
31
|
-
if (typeof val === "string") {
|
|
32
|
-
const key = val[0].toUpperCase() + val.slice(1).toLowerCase()
|
|
33
|
-
if (key in LogLevel) {
|
|
34
|
-
return LogLevel[key as keyof typeof LogLevel]
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return LogLevel.Silent
|
|
38
|
-
}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import {visit} from "unist-util-visit"
|
|
2
|
-
import type {Plugin} from "unified"
|
|
3
|
-
import type {Node} from "unist"
|
|
4
|
-
import {Logger, LogLevel, resolveLogLevel} from "./logger"
|
|
5
|
-
|
|
6
|
-
interface Options {
|
|
7
|
-
logLevel?: LogLevel
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const remarkCodeSections: Plugin<[Options?]> = (options?: Options) => {
|
|
11
|
-
const logger = new Logger(resolveLogLevel(options?.logLevel), "remarkCodeSections")
|
|
12
|
-
|
|
13
|
-
const desc_text = "@desc:"
|
|
14
|
-
const command_text = "@command:"
|
|
15
|
-
const code_text = "@code:"
|
|
16
|
-
const results_text = "@results:"
|
|
17
|
-
|
|
18
|
-
return (tree: Node) => {
|
|
19
|
-
visit(tree, "code", (node: any, index: number, parent: any) => {
|
|
20
|
-
if (!node?.value) return
|
|
21
|
-
|
|
22
|
-
const hasActivator = /@desc:|@command:|@code:|@results:/.test(node.value)
|
|
23
|
-
if (!hasActivator) return
|
|
24
|
-
|
|
25
|
-
logger.log(node, LogLevel.Debug)
|
|
26
|
-
if (node.lang && node.lang.startsWith("example")) {
|
|
27
|
-
const lang = node.lang.replace("example-", "").trim()
|
|
28
|
-
const lines = node.value.split("\n")
|
|
29
|
-
let description = "", command = "", code = "", results = "", codeTitle = ""
|
|
30
|
-
let currentSection = ""
|
|
31
|
-
|
|
32
|
-
lines.forEach((line: string) => {
|
|
33
|
-
if (line.startsWith(desc_text)) {
|
|
34
|
-
currentSection = "description"
|
|
35
|
-
description = line.replace(desc_text, "").trim()
|
|
36
|
-
} else if (line.startsWith(command_text)) {
|
|
37
|
-
currentSection = "command"
|
|
38
|
-
command = line.replace(command_text, "").trim()
|
|
39
|
-
} else if (line.startsWith(code_text)) {
|
|
40
|
-
currentSection = "code"
|
|
41
|
-
codeTitle = line.replace(code_text, "").trim()
|
|
42
|
-
} else if (line.startsWith(results_text)) {
|
|
43
|
-
currentSection = "results"
|
|
44
|
-
results = line.replace(results_text, "").trim()
|
|
45
|
-
} else {
|
|
46
|
-
if (currentSection === "description") description += `\n${line}`
|
|
47
|
-
else if (currentSection === "command") command += `\n${line}`
|
|
48
|
-
else if (currentSection === "code") code += `\n${line}`
|
|
49
|
-
else if (currentSection === "results") results += `\n${line}`
|
|
50
|
-
}
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
const divWrapper = {
|
|
54
|
-
type: "div",
|
|
55
|
-
data: { hName: "div", hProperties: { className: "code-section" } },
|
|
56
|
-
children: [] as any[],
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (description) {
|
|
60
|
-
const descDiv = {
|
|
61
|
-
type: "div",
|
|
62
|
-
data: { hName: "div", hProperties: { className: "code-section-desc" } },
|
|
63
|
-
children: [] as any[],
|
|
64
|
-
}
|
|
65
|
-
descDiv.children.push(
|
|
66
|
-
{ type: "paragraph", children: [{ type: "strong", children: [{ type: "text", value: "Description:" }] }] },
|
|
67
|
-
{ type: "paragraph", children: [{ type: "text", value: description.trim() }], data: { hProperties: { style: "padding-bottom: 10px;" } } },
|
|
68
|
-
)
|
|
69
|
-
divWrapper.children.push(descDiv)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (command) {
|
|
73
|
-
const cmdDiv = {
|
|
74
|
-
type: "div",
|
|
75
|
-
data: { hName: "div", hProperties: { className: "code-section-command" } },
|
|
76
|
-
children: [] as any[],
|
|
77
|
-
}
|
|
78
|
-
cmdDiv.children.push(
|
|
79
|
-
{ type: "paragraph", children: [{ type: "strong", children: [{ type: "text", value: "Command:" }] }] },
|
|
80
|
-
{ type: "code", lang: "sh", value: command.trim() },
|
|
81
|
-
)
|
|
82
|
-
divWrapper.children.push(cmdDiv)
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (code) {
|
|
86
|
-
const codeDiv = {
|
|
87
|
-
type: "div",
|
|
88
|
-
data: { hName: "div", hProperties: { className: "code-section-code" } },
|
|
89
|
-
children: [] as any[],
|
|
90
|
-
}
|
|
91
|
-
codeDiv.children.push(
|
|
92
|
-
{ type: "paragraph", children: [{ type: "strong", children: [{ type: "text", value: codeTitle }] }] },
|
|
93
|
-
{ type: "code", lang, value: code.trim() },
|
|
94
|
-
)
|
|
95
|
-
divWrapper.children.push(codeDiv)
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if (results) {
|
|
99
|
-
const resultsDiv = {
|
|
100
|
-
type: "div",
|
|
101
|
-
data: { hName: "div", hProperties: { className: "code-section-results" } },
|
|
102
|
-
children: [] as any[],
|
|
103
|
-
}
|
|
104
|
-
resultsDiv.children.push(
|
|
105
|
-
{ type: "paragraph", children: [{ type: "strong", children: [{ type: "text", value: "Results:" }] }] },
|
|
106
|
-
{ type: "code", lang: "buttonless", value: results.trim() },
|
|
107
|
-
)
|
|
108
|
-
divWrapper.children.push(resultsDiv)
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
parent.children.splice(index, 1, divWrapper)
|
|
112
|
-
}
|
|
113
|
-
})
|
|
114
|
-
}
|
|
115
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Plugin } from 'unified'
|
|
2
|
-
import { visit } from 'unist-util-visit'
|
|
3
|
-
import { Root } from 'mdast'
|
|
4
|
-
import {Logger, LogLevel, resolveLogLevel} from './logger'
|
|
5
|
-
|
|
6
|
-
console.log("🦖 remarkReplaceMetaUrl plugin loaded")
|
|
7
|
-
|
|
8
|
-
interface Options {
|
|
9
|
-
from: string
|
|
10
|
-
to: string
|
|
11
|
-
logLevel?: LogLevel
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const remarkReplaceMetaUrl: Plugin<[Options], Root> = (options?: Options) => {
|
|
15
|
-
const { from = '', to = '', logLevel = LogLevel.Silent } = options ?? {}
|
|
16
|
-
const logger = new Logger(resolveLogLevel(options?.logLevel), 'remarkReplaceMetaUrl')
|
|
17
|
-
|
|
18
|
-
logger.log(`initialized: replacing "${from}" → "${to}"`)
|
|
19
|
-
|
|
20
|
-
return (tree: Root) => {
|
|
21
|
-
visit(tree, 'mdxJsxFlowElement', (node: any) => {
|
|
22
|
-
if (node.name === 'meta' && Array.isArray(node.attributes)) {
|
|
23
|
-
for (const attr of node.attributes) {
|
|
24
|
-
if (attr.name === 'content' && typeof attr.value === 'string' && attr.value.includes(from)) {
|
|
25
|
-
const newVal = attr.value.replace(from, to)
|
|
26
|
-
logger.log(`rewriting: "${attr.value}" → "${newVal}"`, LogLevel.Info)
|
|
27
|
-
attr.value = newVal
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
})
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export default remarkReplaceMetaUrl
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { Plugin } from 'unified'
|
|
2
|
-
import { visit } from 'unist-util-visit'
|
|
3
|
-
import { Image, Link } from 'mdast'
|
|
4
|
-
import { MdxJsxFlowElement, MdxjsEsm } from 'mdast-util-mdx'
|
|
5
|
-
import {Logger, LogLevel, resolveLogLevel} from './logger'
|
|
6
|
-
|
|
7
|
-
console.log("🦖 remarkScopedPath plugin module loaded")
|
|
8
|
-
|
|
9
|
-
interface ScopedPathOptions {
|
|
10
|
-
from: string
|
|
11
|
-
to: string
|
|
12
|
-
}
|
|
13
|
-
interface Options {
|
|
14
|
-
mappings: ScopedPathOptions[]
|
|
15
|
-
logLevel?: LogLevel
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const remarkScopedPath: Plugin<[Options]> = (options?: Options) => {
|
|
19
|
-
const { mappings = [], logLevel = LogLevel.Silent } = options ?? {}
|
|
20
|
-
const logger = new Logger(resolveLogLevel(options?.logLevel), 'remarkScopedPath')
|
|
21
|
-
|
|
22
|
-
logger.log(`initialized with ${mappings.length} mappings`)
|
|
23
|
-
|
|
24
|
-
return (tree, file) => {
|
|
25
|
-
const filePath = file?.path || file?.history?.slice(-1)[0] || 'unknown'
|
|
26
|
-
logger.log(`processing file: ${filePath}`, LogLevel.Debug)
|
|
27
|
-
|
|
28
|
-
const rewrite = (val: string, from: string, to: string, ctx: string) => {
|
|
29
|
-
if (val.startsWith(from)) {
|
|
30
|
-
const newVal = val.replace(from, to)
|
|
31
|
-
logger.log(`🔄 ${ctx} ${val} → ${newVal}`, LogLevel.Info)
|
|
32
|
-
return newVal
|
|
33
|
-
}
|
|
34
|
-
return val
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
visit(tree, 'image', (node: Image) => {
|
|
38
|
-
for (const { from, to } of mappings) node.url = rewrite(node.url, from, to, 'img')
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
visit(tree, 'link', (node: Link) => {
|
|
42
|
-
for (const { from, to } of mappings) node.url = rewrite(node.url, from, to, 'link')
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
visit(tree, 'mdxJsxFlowElement', (node: MdxJsxFlowElement) => {
|
|
46
|
-
node.attributes?.forEach(attr => {
|
|
47
|
-
if (attr.type === 'mdxJsxAttribute' && typeof attr.value === 'string') {
|
|
48
|
-
for (const { from, to } of mappings)
|
|
49
|
-
attr.value = rewrite(attr.value, from, to, `jsx <${node.name}> ${attr.name}:`)
|
|
50
|
-
}
|
|
51
|
-
})
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
visit(tree, 'mdxjsEsm', (node: MdxjsEsm) => {
|
|
55
|
-
for (const { from, to } of mappings) {
|
|
56
|
-
const re = new RegExp(`(['"])${from}/`, 'g')
|
|
57
|
-
const newVal = node.value.replace(re, `$1${to}/`)
|
|
58
|
-
if (newVal !== node.value) {
|
|
59
|
-
logger.log(
|
|
60
|
-
`esm rewrite (${from} → ${to}):\n--- before ---\n${node.value}\n--- after ---\n${newVal}`,
|
|
61
|
-
LogLevel.Info
|
|
62
|
-
)
|
|
63
|
-
node.value = newVal
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
logger.log(` `, LogLevel.Debug)
|
|
69
|
-
}
|
|
70
|
-
}
|