@netfoundry/docusaurus-theme 0.1.3 → 0.1.5
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/dist/css/layout.css +14 -0
- package/dist/css/legacy.css +2347 -0
- package/dist/css/theme.css +20 -0
- package/dist/css/vars-dark.css +7 -0
- package/dist/css/vars.css +8 -0
- 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 +23 -15
- 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,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
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { Plugin } from 'unified'
|
|
2
|
-
import { visit } from 'unist-util-visit'
|
|
3
|
-
import yaml from 'js-yaml'
|
|
4
|
-
import { Parent } from 'unist'
|
|
5
|
-
import { Literal } from 'unist'
|
|
6
|
-
import {Logger, LogLevel, resolveLogLevel} from './logger'
|
|
7
|
-
|
|
8
|
-
console.log("🦖 remarkYamlTable plugin module loaded")
|
|
9
|
-
|
|
10
|
-
interface Code extends Literal {
|
|
11
|
-
type: 'code'
|
|
12
|
-
lang?: string
|
|
13
|
-
value: string
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
interface TableCell {
|
|
17
|
-
type: 'tableCell'
|
|
18
|
-
children: { type: 'text'; value: string }[]
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
interface TableRow {
|
|
22
|
-
type: 'tableRow'
|
|
23
|
-
children: TableCell[]
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
interface Table {
|
|
27
|
-
type: 'table'
|
|
28
|
-
align: (null | 'left' | 'right' | 'center')[]
|
|
29
|
-
children: TableRow[]
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
interface Options {
|
|
33
|
-
logLevel?: LogLevel
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export const remarkYamlTable: Plugin<[Options]> = (options?: Options) => {
|
|
37
|
-
const { logLevel = LogLevel.Silent } = options ?? {}
|
|
38
|
-
const logger = new Logger(resolveLogLevel(options?.logLevel), 'remarkYamlTable')
|
|
39
|
-
|
|
40
|
-
logger.log('initialized')
|
|
41
|
-
|
|
42
|
-
return (tree) => {
|
|
43
|
-
visit(tree, 'code', (node: Code, index: number | undefined, parent: Parent | undefined) => {
|
|
44
|
-
if (!parent || index === undefined) return
|
|
45
|
-
if (node.lang === 'yaml-table') {
|
|
46
|
-
try {
|
|
47
|
-
const data = yaml.load(node.value)
|
|
48
|
-
if (Array.isArray(data) && data.length > 0 && typeof data[0] === 'object') {
|
|
49
|
-
const headers = Object.keys(data[0] as Record<string, unknown>)
|
|
50
|
-
|
|
51
|
-
const tableRows: TableRow[] = (data as Record<string, unknown>[]).map((row) => ({
|
|
52
|
-
type: 'tableRow',
|
|
53
|
-
children: headers.map<TableCell>((header) => ({
|
|
54
|
-
type: 'tableCell',
|
|
55
|
-
children: [{ type: 'text', value: String(row[header] ?? '') }],
|
|
56
|
-
})),
|
|
57
|
-
}))
|
|
58
|
-
|
|
59
|
-
const tableNode: Table = {
|
|
60
|
-
type: 'table',
|
|
61
|
-
align: headers.map(() => null),
|
|
62
|
-
children: [
|
|
63
|
-
{
|
|
64
|
-
type: 'tableRow',
|
|
65
|
-
children: headers.map<TableCell>((header) => ({
|
|
66
|
-
type: 'tableCell',
|
|
67
|
-
children: [{ type: 'text', value: header }],
|
|
68
|
-
})),
|
|
69
|
-
},
|
|
70
|
-
...tableRows,
|
|
71
|
-
],
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
parent.children[index] = tableNode
|
|
75
|
-
logger.log(`generated table with ${headers.length} columns and ${data.length} rows`, LogLevel.Info)
|
|
76
|
-
}
|
|
77
|
-
} catch (error) {
|
|
78
|
-
logger.log(`YAML parsing error: ${(error as Error).message}`, LogLevel.Info)
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
})
|
|
82
|
-
}
|
|
83
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import type { Plugin } from 'unified'
|
|
2
|
-
import { visit } from 'unist-util-visit'
|
|
3
|
-
import type { Node } from 'unist'
|
|
4
|
-
import {Logger, LogLevel, resolveLogLevel} from './logger'
|
|
5
|
-
|
|
6
|
-
console.log("🦖 remarkYouTube plugin module loaded")
|
|
7
|
-
|
|
8
|
-
interface YouTubeOptions {
|
|
9
|
-
logLevel?: LogLevel
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const remarkYouTube: Plugin<[YouTubeOptions]> = (options?: YouTubeOptions) => {
|
|
13
|
-
const { logLevel = LogLevel.Silent } = options ?? {}
|
|
14
|
-
const logger = new Logger(resolveLogLevel(options?.logLevel), 'remarkYouTube')
|
|
15
|
-
|
|
16
|
-
logger.log('initialized')
|
|
17
|
-
|
|
18
|
-
return (tree: Node) => {
|
|
19
|
-
visit(tree, ['link', 'text'], (node: any, index: number | undefined, parent: any) => {
|
|
20
|
-
if (!parent || typeof index !== 'number') return
|
|
21
|
-
let raw = node.url || node.value || ''
|
|
22
|
-
let ytUrl = raw.trim()
|
|
23
|
-
|
|
24
|
-
const hashnodeMatch = ytUrl.match(/^%\[(.+)\]$/)
|
|
25
|
-
if (hashnodeMatch) {
|
|
26
|
-
ytUrl = hashnodeMatch[1]
|
|
27
|
-
logger.log(`hashnode-style embed detected: ${ytUrl}`, LogLevel.Info)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const m =
|
|
31
|
-
ytUrl.match(/youtube\.com\/watch\?v=([A-Za-z0-9_-]+)/) ||
|
|
32
|
-
ytUrl.match(/youtu\.be\/([A-Za-z0-9_-]+)/) ||
|
|
33
|
-
ytUrl.match(/youtube-nocookie\.com\/watch\?v=([A-Za-z0-9_-]+)/)
|
|
34
|
-
|
|
35
|
-
if (m) {
|
|
36
|
-
logger.log(`rewriting YouTube URL: ${ytUrl} → videoId=${m[1]}`, LogLevel.Debug)
|
|
37
|
-
parent.children.splice(index, 1, {
|
|
38
|
-
type: 'mdxJsxFlowElement',
|
|
39
|
-
name: 'LiteYouTubeEmbed',
|
|
40
|
-
attributes: [
|
|
41
|
-
{ type: 'mdxJsxAttribute', name: 'id', value: m[1] },
|
|
42
|
-
{ type: 'mdxJsxAttribute', name: 'title', value: 'YouTube video' },
|
|
43
|
-
],
|
|
44
|
-
})
|
|
45
|
-
}
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
visit(tree, 'text', (node: any, index: number | undefined, parent: any) => {
|
|
49
|
-
if (!parent || typeof index !== 'number') return
|
|
50
|
-
if (node.value.trim() === '%[' || node.value.trim() === ']') {
|
|
51
|
-
logger.log(`stripping hashnode bracket artifact: ${node.value}`, LogLevel.Debug)
|
|
52
|
-
parent.children.splice(index, 1)
|
|
53
|
-
}
|
|
54
|
-
})
|
|
55
|
-
}
|
|
56
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Plugin } from "unified"
|
|
2
|
-
import {Logger, LogLevel, resolveLogLevel} from './logger'
|
|
3
|
-
|
|
4
|
-
export function timedPlugin<T extends Plugin>(
|
|
5
|
-
name: string,
|
|
6
|
-
plugin: T,
|
|
7
|
-
opts: { logLevel?: LogLevel } = {}
|
|
8
|
-
): T {
|
|
9
|
-
const { logLevel = LogLevel.Info } = opts
|
|
10
|
-
const logger = new Logger(resolveLogLevel(opts?.logLevel), name)
|
|
11
|
-
|
|
12
|
-
return ((...args: any[]) => {
|
|
13
|
-
const instance = (plugin as any)(...args)
|
|
14
|
-
return (tree: any, file: any) => {
|
|
15
|
-
const start = Date.now()
|
|
16
|
-
const res = instance(tree, file)
|
|
17
|
-
const dur = Date.now() - start
|
|
18
|
-
logger.log(`⏱ finished in ${dur}ms`)
|
|
19
|
-
return res
|
|
20
|
-
}
|
|
21
|
-
}) as any
|
|
22
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { LoadContext, Plugin } from '@docusaurus/types';
|
|
2
|
-
import type { NetFoundryThemeOptions } from './options';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
|
|
5
|
-
export default function themeNetFoundry(
|
|
6
|
-
context: LoadContext,
|
|
7
|
-
options: NetFoundryThemeOptions = {}
|
|
8
|
-
): Plugin {
|
|
9
|
-
return {
|
|
10
|
-
name: '@netfoundry/docusaurus-theme',
|
|
11
|
-
|
|
12
|
-
// Register theme component overrides
|
|
13
|
-
getThemePath() {
|
|
14
|
-
return path.resolve(__dirname, '../theme');
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
// For TypeScript development
|
|
18
|
-
getTypeScriptThemePath() {
|
|
19
|
-
return path.resolve(__dirname, '../theme');
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
// Automatically inject CSS
|
|
23
|
-
getClientModules() {
|
|
24
|
-
const modules: string[] = [
|
|
25
|
-
require.resolve('../css/theme.css'),
|
|
26
|
-
];
|
|
27
|
-
|
|
28
|
-
// Add custom CSS if specified in options
|
|
29
|
-
if (options.customCss) {
|
|
30
|
-
const customCssArray = Array.isArray(options.customCss)
|
|
31
|
-
? options.customCss
|
|
32
|
-
: [options.customCss];
|
|
33
|
-
modules.push(...customCssArray);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return modules;
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Re-export types for consumers (types are safe to export at config time)
|
|
42
|
-
export type { NetFoundryThemeOptions, NetFoundryThemeConfig } from './options';
|
|
43
|
-
|
|
44
|
-
// NOTE: UI components (defaultNetFoundryFooterProps, defaultSocialProps, etc.)
|
|
45
|
-
// should be imported directly from '@netfoundry/docusaurus-shared/ui' in client code,
|
|
46
|
-
// not from this theme entry point, as this file runs at Node.js config time.
|
package/src/version.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const version = '0.1.1';
|
package/theme/Layout/index.tsx
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import React, { type ReactNode } from 'react';
|
|
2
|
-
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
3
|
-
import {
|
|
4
|
-
NetFoundryLayout,
|
|
5
|
-
defaultNetFoundryFooterProps,
|
|
6
|
-
defaultSocialProps,
|
|
7
|
-
} from '../../src/ui';
|
|
8
|
-
import type { ThemeConfigWithNetFoundry } from '../../src/options';
|
|
9
|
-
|
|
10
|
-
export interface LayoutProps {
|
|
11
|
-
children: ReactNode;
|
|
12
|
-
noFooter?: boolean;
|
|
13
|
-
wrapperClassName?: string;
|
|
14
|
-
title?: string;
|
|
15
|
-
description?: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* NetFoundry theme Layout component.
|
|
20
|
-
*
|
|
21
|
-
* This component wraps NetFoundryLayout and reads configuration from
|
|
22
|
-
* themeConfig.netfoundry in docusaurus.config.ts.
|
|
23
|
-
*
|
|
24
|
-
* To customize further, swizzle this component:
|
|
25
|
-
* npx docusaurus swizzle @netfoundry/docusaurus-theme Layout --wrap
|
|
26
|
-
*/
|
|
27
|
-
export default function Layout({
|
|
28
|
-
children,
|
|
29
|
-
noFooter,
|
|
30
|
-
wrapperClassName,
|
|
31
|
-
title,
|
|
32
|
-
description,
|
|
33
|
-
}: LayoutProps): ReactNode {
|
|
34
|
-
const { siteConfig } = useDocusaurusContext();
|
|
35
|
-
const themeConfig = siteConfig.themeConfig as ThemeConfigWithNetFoundry;
|
|
36
|
-
const nfConfig = themeConfig.netfoundry ?? {};
|
|
37
|
-
|
|
38
|
-
// Build footer props from config, falling back to defaults
|
|
39
|
-
const footerProps = noFooter
|
|
40
|
-
? undefined
|
|
41
|
-
: {
|
|
42
|
-
...defaultNetFoundryFooterProps(),
|
|
43
|
-
...nfConfig.footer,
|
|
44
|
-
socialProps: {
|
|
45
|
-
...defaultSocialProps,
|
|
46
|
-
...nfConfig.footer?.socialProps,
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
// Build star props if enabled
|
|
51
|
-
const starProps =
|
|
52
|
-
nfConfig.showStarBanner && nfConfig.starBanner
|
|
53
|
-
? {
|
|
54
|
-
repoUrl: nfConfig.starBanner.repoUrl,
|
|
55
|
-
label: nfConfig.starBanner.label,
|
|
56
|
-
}
|
|
57
|
-
: undefined;
|
|
58
|
-
|
|
59
|
-
return (
|
|
60
|
-
<NetFoundryLayout
|
|
61
|
-
title={title}
|
|
62
|
-
description={description}
|
|
63
|
-
className={wrapperClassName}
|
|
64
|
-
noFooter={noFooter}
|
|
65
|
-
footerProps={footerProps}
|
|
66
|
-
starProps={starProps}
|
|
67
|
-
meta={{
|
|
68
|
-
siteName: siteConfig.title,
|
|
69
|
-
}}
|
|
70
|
-
>
|
|
71
|
-
{children}
|
|
72
|
-
</NetFoundryLayout>
|
|
73
|
-
);
|
|
74
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|