sourcey 3.4.6 → 3.4.8
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/components/layout/Head.d.ts.map +1 -1
- package/dist/components/layout/Head.js +1 -1
- package/dist/components/layout/Header.d.ts.map +1 -1
- package/dist/components/layout/Header.js +2 -2
- package/dist/components/layout/Page.js +2 -2
- package/dist/components/layout/Sidebar.js +1 -1
- package/dist/components/layout/TableOfContents.js +2 -2
- package/dist/components/openapi/Parameters.js +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +9 -13
- package/dist/core/markdown-loader.d.ts.map +1 -1
- package/dist/core/markdown-loader.js +136 -40
- package/dist/themes/default/main.css +1 -1
- package/dist/themes/default/sourcey.css +6 -8
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Head.d.ts","sourceRoot":"","sources":["../../../src/components/layout/Head.tsx"],"names":[],"mappings":"AAKA,wBAAgB,IAAI,
|
|
1
|
+
{"version":3,"file":"Head.d.ts","sourceRoot":"","sources":["../../../src/components/layout/Head.tsx"],"names":[],"mappings":"AAKA,wBAAgB,IAAI,iCAwEnB"}
|
|
@@ -44,5 +44,5 @@ export function Head() {
|
|
|
44
44
|
body { margin: 0; background: rgb(var(--color-background-light)); }
|
|
45
45
|
.dark body { background: rgb(var(--color-background-dark)); }
|
|
46
46
|
`;
|
|
47
|
-
return (_jsxs("head", { children: [_jsx("meta", { charset: "utf-8" }), _jsx("meta", { name: "viewport", content: "width=device-width, initial-scale=1" }), _jsx("title", { children: pageTitle }), _jsx("meta", { name: "description", content: pageDescription }), _jsx("meta", { name: "generator", content: `Sourcey ${pkg.version}` }), _jsx("meta", { property: "og:title", content: pageTitle }), _jsx("meta", { property: "og:description", content: pageDescription }), _jsx("meta", { property: "og:type", content: "website" }), siteName && _jsx("meta", { property: "og:site_name", content: siteName }), _jsx("meta", { name: "twitter:card", content: "summary" }), _jsx("meta", { name: "twitter:title", content: pageTitle }), _jsx("meta", { name: "twitter:description", content: pageDescription }), _jsx("meta", { name: "sourcey-search", content: `${options.assetBase}search-index.json` }), _jsx("style", { dangerouslySetInnerHTML: { __html: themeCSS } }), showLangIconCSS && _jsx("style", { dangerouslySetInnerHTML: { __html: langIconCSS() } }), site.customCSS && _jsx("style", { dangerouslySetInnerHTML: { __html: site.customCSS } }), _jsx("script", { dangerouslySetInnerHTML: { __html: `(function(){var t=localStorage.getItem('sourcey-theme');if(t==='dark')document.documentElement.classList.add('dark')})()` } }), _jsx("link", { rel: "stylesheet", href: `${options.assetBase}sourcey.css` }), site.favicon && _jsx("link", { rel: "icon", href: site.favicon })] }));
|
|
47
|
+
return (_jsxs("head", { children: [_jsx("meta", { charset: "utf-8" }), _jsx("meta", { name: "viewport", content: "width=device-width, initial-scale=1" }), _jsx("title", { children: pageTitle }), _jsx("meta", { name: "description", content: pageDescription }), _jsx("meta", { name: "generator", content: `Sourcey ${pkg.version}` }), _jsx("meta", { property: "og:title", content: pageTitle }), _jsx("meta", { property: "og:description", content: pageDescription }), _jsx("meta", { property: "og:type", content: "website" }), siteName && _jsx("meta", { property: "og:site_name", content: siteName }), _jsx("meta", { name: "twitter:card", content: "summary" }), _jsx("meta", { name: "twitter:title", content: pageTitle }), _jsx("meta", { name: "twitter:description", content: pageDescription }), _jsx("meta", { name: "sourcey-search", content: `${options.assetBase}search-index.json` }), _jsx("link", { rel: "preconnect", href: "https://fonts.googleapis.com" }), _jsx("link", { rel: "preconnect", href: "https://fonts.gstatic.com", crossorigin: "anonymous" }), _jsx("link", { rel: "stylesheet", href: `https://fonts.googleapis.com/css2?family=${encodeURIComponent(fonts.googleFont)}:wght@100..900&display=swap` }), _jsx("style", { dangerouslySetInnerHTML: { __html: themeCSS } }), showLangIconCSS && _jsx("style", { dangerouslySetInnerHTML: { __html: langIconCSS() } }), site.customCSS && _jsx("style", { dangerouslySetInnerHTML: { __html: site.customCSS } }), _jsx("script", { dangerouslySetInnerHTML: { __html: `(function(){var t=localStorage.getItem('sourcey-theme');if(t==='dark')document.documentElement.classList.add('dark')})()` } }), _jsx("link", { rel: "stylesheet", href: `${options.assetBase}sourcey.css` }), site.favicon && _jsx("link", { rel: "icon", href: site.favicon })] }));
|
|
48
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../../src/components/layout/Header.tsx"],"names":[],"mappings":"AA6EA;;;;;GAKG;AACH,wBAAgB,MAAM,
|
|
1
|
+
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../../src/components/layout/Header.tsx"],"names":[],"mappings":"AA6EA;;;;;GAKG;AACH,wBAAgB,MAAM,iCAsIrB"}
|
|
@@ -39,10 +39,10 @@ export function Header() {
|
|
|
39
39
|
const logoHref = site.logo?.href ?? `${base}${nav.tabs[0]?.href ?? ""}`;
|
|
40
40
|
return (_jsxs("div", { id: "navbar", class: "z-30 fixed lg:sticky top-0 w-full", children: [_jsx("div", { class: "absolute w-full h-full flex-none border-b border-[rgb(var(--color-gray-200)/0.7)] dark:border-[rgb(var(--color-gray-300)/0.06)] bg-[rgb(var(--color-background-light))] dark:bg-[rgb(var(--color-background-dark))]" }), _jsxs("div", { class: "max-w-[92rem] mx-auto relative", children: [_jsx("div", { class: "relative", children: _jsx("div", { class: "flex items-center lg:px-12 h-16 min-w-0 mx-4 lg:mx-0", children: _jsxs("div", { class: "h-full relative flex-1 flex items-center gap-x-4 min-w-0 border-b border-[rgb(var(--color-gray-500)/0.08)] dark:border-[rgb(var(--color-gray-300)/0.08)]", children: [_jsx("div", { class: "flex-1 flex items-center gap-x-4", children: _jsx(Logo, { href: logoHref, logo: site.logo, name: site.name }) }), _jsx("div", { class: "relative hidden lg:flex items-center flex-1 z-20 gap-2", children: _jsx("button", { id: "search-open", type: "button", class: "group flex pointer-events-auto rounded-lg w-full items-center text-sm leading-6 h-9 pl-3.5 pr-3 text-[rgb(var(--color-gray-500))] dark:text-[rgb(var(--color-gray-400))] ring-1 ring-[rgb(var(--color-gray-400)/0.3)] hover:ring-[rgb(var(--color-gray-600)/0.3)] dark:ring-[rgb(var(--color-gray-600)/0.3)] dark:hover:ring-[rgb(var(--color-gray-500)/0.3)] justify-between truncate gap-2 min-w-[43px] cursor-pointer bg-[rgb(var(--color-background-light))] dark:bg-[rgb(var(--color-background-dark))] dark:brightness-110 dark:hover:brightness-125", children: _jsxs("div", { class: "flex items-center gap-2 min-w-[42px]", children: [_jsx(SearchIcon, {}), _jsxs("div", { class: "truncate min-w-0", children: ["Type ", _jsx("kbd", { children: "/" }), " to search"] })] }) }) }), _jsxs("div", { class: "flex-1 relative hidden lg:flex items-center ml-auto justify-end space-x-4", children: [_jsx("nav", { class: "text-sm", children: _jsxs("ul", { class: "flex space-x-6 items-center", children: [site.navbar.links.map((link) => (_jsx("li", { children: _jsx("a", { href: link.href, target: "_blank", rel: "noopener noreferrer", "aria-label": link.label ?? socialLabels[link.type] ?? link.href, class: "text-[rgb(var(--color-gray-500))] hover:text-[rgb(var(--color-gray-700))] dark:text-[rgb(var(--color-gray-400))] dark:hover:text-[rgb(var(--color-gray-300))]", children: link.type === "link"
|
|
41
41
|
? (link.label ?? link.href)
|
|
42
|
-
: (_jsxs(_Fragment, { children: [_jsx(SocialIcon, { type: link.type }), link.label && _jsx("span", { class: "ml-1", children: link.label })] })) }) }, link.href))), site.navbar.primary && (_jsx("li", { children: _jsxs("a", { href: site.navbar.primary.href, target: "_blank", class: "group px-4 py-1.5 relative inline-flex items-center text-sm font-medium", children: [_jsx("span", { class: "absolute inset-0 bg-[rgb(var(--color-primary-dark))] rounded-lg group-hover:opacity-90" }),
|
|
42
|
+
: (_jsxs(_Fragment, { children: [_jsx(SocialIcon, { type: link.type }), link.label && _jsx("span", { class: "ml-1", children: link.label })] })) }) }, link.href))), site.navbar.primary && (_jsx("li", { children: _jsxs("a", { href: site.navbar.primary.href, target: "_blank", class: "group px-4 py-1.5 relative inline-flex items-center text-sm font-medium", children: [_jsx("span", { class: "absolute inset-0 bg-[rgb(var(--color-primary-dark))] rounded-lg group-hover:opacity-90" }), _jsxs("div", { class: "mr-0.5 space-x-2.5 flex items-center text-white", children: [_jsx("span", { class: "z-10", children: site.navbar.primary.label }), _jsx("svg", { width: "3", height: "6", viewBox: "0 0 3 6", class: "overflow-visible opacity-90", children: _jsx("path", { d: "M0 0L3 3L0 6", fill: "none", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round" }) })] })] }) }))] }) }), _jsxs("button", { id: "theme-toggle", type: "button", "aria-label": "Toggle theme", class: "p-2 flex items-center justify-center cursor-pointer text-[rgb(var(--color-gray-400))] hover:text-[rgb(var(--color-gray-600))] dark:text-[rgb(var(--color-gray-500))] dark:hover:text-[rgb(var(--color-gray-300))]", children: [_jsx(SunIcon, {}), _jsx(MoonIcon, {})] })] }), _jsxs("div", { class: "flex lg:hidden items-center gap-3", children: [_jsx("button", { id: "search-open-mobile", type: "button", "aria-label": "Search", class: "text-[rgb(var(--color-gray-500))] w-8 h-8 flex items-center justify-center", children: _jsx(SearchIcon, {}) }), _jsx("button", { type: "button", "data-drawer-slide": "right", "aria-label": "Open menu", class: "text-[rgb(var(--color-gray-500))] w-8 h-8 flex items-center justify-center hover:text-[rgb(var(--color-gray-600))]", children: _jsx("svg", { class: "h-4", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 448 512", children: _jsx("path", { d: "M0 96C0 78.3 14.3 64 32 64H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32C14.3 128 0 113.7 0 96zM0 256c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32zM448 416c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32z" }) }) })] })] }) }) }), _jsx(MobileBreadcrumbs, { nav: nav }), nav.tabs.length > 1 && (_jsx("div", { class: "hidden lg:flex px-12 h-12", children: _jsx("div", { class: "h-full flex text-sm gap-x-6", children: nav.tabs.map((tab) => {
|
|
43
43
|
const isActive = tab.slug === nav.activeTabSlug;
|
|
44
44
|
return (_jsxs("a", { href: `${base}${tab.href}`, class: `group relative h-full gap-2 flex items-center font-medium cursor-pointer transition-colors ${isActive
|
|
45
|
-
? "text-[rgb(var(--color-gray-800))] dark:text-[rgb(var(--color-gray-200))]"
|
|
45
|
+
? "text-[rgb(var(--color-gray-800))] dark:text-[rgb(var(--color-gray-200))] [text-shadow:-0.2px_0_0_currentColor,0.2px_0_0_currentColor]"
|
|
46
46
|
: "text-[rgb(var(--color-gray-600))] dark:text-[rgb(var(--color-gray-400))] hover:text-[rgb(var(--color-gray-800))] dark:hover:text-[rgb(var(--color-gray-300))]"}`, children: [tab.label, isActive ? (_jsx("div", { class: "absolute bottom-0 h-[1.5px] w-full left-0 bg-[rgb(var(--color-primary))] dark:bg-[rgb(var(--color-primary-light))]" })) : (_jsx("div", { class: "absolute bottom-0 h-[1.5px] w-full left-0 group-hover:bg-[rgb(var(--color-gray-200))] dark:group-hover:bg-[rgb(var(--color-gray-700))]" }))] }, tab.slug));
|
|
47
47
|
}) }) }))] })] }));
|
|
48
48
|
}
|
|
@@ -75,7 +75,7 @@ function ContentFooter() {
|
|
|
75
75
|
// ---------------------------------------------------------------------------
|
|
76
76
|
function DefaultLayout() {
|
|
77
77
|
const page = useContext(PageContext);
|
|
78
|
-
return (_jsxs("div", { class: "max-w-[92rem] mx-auto relative px-4 lg:px-
|
|
78
|
+
return (_jsxs("div", { class: "max-w-[92rem] mx-auto relative px-4 lg:px-8", children: [_jsx(Sidebar, {}), _jsx("main", { id: "docs", class: "pt-[8.5rem] lg:pt-10", children: page.kind === "markdown" ? (_jsxs("div", { class: "flex flex-row-reverse gap-12 box-border w-full", children: [_jsx(TableOfContents, { headings: page.markdown.headings }), _jsx(MarkdownPageContent, { page: page.markdown, className: "lg:pl-[23.7rem] lg:-ml-12 xl:w-[calc(100%-28rem)]" })] })) : (_jsx(SpecPageContent, { className: "lg:pl-[23.7rem] lg:-ml-12" })) })] }));
|
|
79
79
|
}
|
|
80
80
|
function MinimalLayout() {
|
|
81
81
|
const page = useContext(PageContext);
|
|
@@ -83,7 +83,7 @@ function MinimalLayout() {
|
|
|
83
83
|
}
|
|
84
84
|
function ApiFirstLayout() {
|
|
85
85
|
const page = useContext(PageContext);
|
|
86
|
-
return (_jsxs("div", { class: "max-w-[92rem] mx-auto relative px-4 lg:px-
|
|
86
|
+
return (_jsxs("div", { class: "max-w-[92rem] mx-auto relative px-4 lg:px-8", children: [_jsx(Sidebar, {}), _jsx("main", { id: "docs", class: "pt-[8.5rem] lg:pt-10", children: page.kind === "markdown" ? (_jsxs("div", { class: "flex flex-row-reverse gap-12 box-border w-full", children: [_jsx(TableOfContents, { headings: page.markdown.headings }), _jsx(MarkdownPageContent, { page: page.markdown, className: "lg:pl-[23.7rem] lg:-ml-12 xl:w-[calc(100%-28rem)]" })] })) : (_jsx(SpecPageContent, { className: "lg:pl-[23.7rem] lg:-ml-12" })) })] }));
|
|
87
87
|
}
|
|
88
88
|
// ---------------------------------------------------------------------------
|
|
89
89
|
// Page shell
|
|
@@ -32,7 +32,7 @@ function MethodPill({ method }) {
|
|
|
32
32
|
* Shared nav group rendering used by both desktop sidebar and mobile drawer.
|
|
33
33
|
*/
|
|
34
34
|
function NavGroups({ groups, activePageSlug, base }) {
|
|
35
|
-
return (_jsx(_Fragment, { children: groups.map((group, gi) => (_jsxs("div", { class: gi > 0 ? "mt-
|
|
35
|
+
return (_jsx(_Fragment, { children: groups.map((group, gi) => (_jsxs("div", { class: gi > 0 ? "mt-6 lg:mt-8" : "", children: [group.label && (_jsx("h5", { class: "nav-group-label", children: group.label })), _jsx("ul", { class: "space-y-px", children: group.items.map((item) => {
|
|
36
36
|
const isActive = item.id === activePageSlug;
|
|
37
37
|
return (_jsx("li", { children: _jsxs("a", { href: `${base}${item.href}`, class: `nav-link${isActive ? " active" : ""}`, children: [item.method && _jsx(MethodPill, { method: item.method }), _jsx("span", { class: "flex-1 break-words [word-break:break-word]", children: item.label })] }) }, item.id));
|
|
38
38
|
}) })] }, group.label))) }));
|
|
@@ -17,10 +17,10 @@ function TocList({ headings }) {
|
|
|
17
17
|
groups[groups.length - 1].children.push(h);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
return (_jsx("ul", { children: groups.map((g) => (_jsxs("li", { children: [_jsx("a", { href: `#${g.root.id}`, class: `${tocLink} py-1`, children: g.root.text }), g.children.length > 0 && (_jsx("ul", { children: g.children.map((c) => (_jsx("li", { children: _jsx("a", { href: `#${c.id}`, class: `${tocLink} pl-3 text-[
|
|
20
|
+
return (_jsx("ul", { children: groups.map((g) => (_jsxs("li", { children: [_jsx("a", { href: `#${g.root.id}`, class: `${tocLink} py-1 font-medium`, children: g.root.text }), g.children.length > 0 && (_jsx("ul", { class: "mb-2", children: g.children.map((c) => (_jsx("li", { children: _jsx("a", { href: `#${c.id}`, class: `${tocLink} pl-3 py-1 text-[rgb(var(--color-gray-500))]`, children: c.text }) }, c.id))) }))] }, g.root.id))) }));
|
|
21
21
|
}
|
|
22
22
|
export function TableOfContents({ headings }) {
|
|
23
23
|
if (headings.length === 0)
|
|
24
24
|
return null;
|
|
25
|
-
return (_jsx("aside", { id: "toc", class: "hidden xl:flex self-start sticky xl:flex-col max-w-[28rem] z-[21]", style: "height: calc(100vh - var(--header-height) - 2.5rem); top: calc(var(--header-height) + 2.5rem)", children: _jsx("div", { class: "z-10 hidden xl:flex box-border max-h-full pl-10 w-[19rem]", children: _jsxs("div", { class: "text-[rgb(var(--color-gray-600))] text-sm leading-6 w-[16.5rem] overflow-y-auto space-y-2 pb-4 -mt-10 pt-10", children: [_jsxs("h5", { class: "font-
|
|
25
|
+
return (_jsx("aside", { id: "toc", class: "hidden xl:flex self-start sticky xl:flex-col max-w-[28rem] z-[21]", style: "height: calc(100vh - var(--header-height) - 2.5rem); top: calc(var(--header-height) + 2.5rem)", children: _jsx("div", { class: "z-10 hidden xl:flex box-border max-h-full pl-10 w-[19rem]", children: _jsxs("div", { class: "text-[rgb(var(--color-gray-600))] text-sm leading-6 w-[16.5rem] overflow-y-auto space-y-2 pb-4 -mt-10 pt-10", children: [_jsxs("h5", { class: "font-medium text-[rgb(var(--color-gray-700))] dark:text-[rgb(var(--color-gray-300))] flex items-center gap-2", children: [_jsx("svg", { class: "shrink-0", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "1.5", dangerouslySetInnerHTML: { __html: iconPath("book-open") ?? "" } }), "On this page"] }), _jsx("nav", { children: _jsx(TocList, { headings: headings }) })] }) }) }));
|
|
26
26
|
}
|
|
@@ -5,5 +5,5 @@ import { Markdown } from "../ui/Markdown.js";
|
|
|
5
5
|
export function Parameters({ parameters }) {
|
|
6
6
|
if (!parameters.length)
|
|
7
7
|
return null;
|
|
8
|
-
return (_jsx("div", { class: "params-list", children: parameters.map((param) => (_jsxs("div", { class: "param-item", children: [_jsxs("div", { class: "param-header", children: [_jsx("code", { class: "param-name", children: param.name }), param.schema && (_jsx("span", { class: "param-type", children: _jsx(SchemaDatatype, { schema: param.schema }) })), param.required && _jsx(RequiredBadge, {}), param.deprecated && _jsx(DeprecatedBadge, {}), _jsx("span", { class: "param-in", children: param.in })] }), param.description && (_jsx("div", { class: "param-description", children: _jsx(Markdown, { content: param.description }) }))] }, `${param.in}-${param.name}`))) }));
|
|
8
|
+
return (_jsx("div", { class: "params-list", children: parameters.map((param) => (_jsxs("div", { class: "param-item", children: [_jsxs("div", { class: "param-header", children: [_jsx("code", { class: "param-name", children: param.name }), param.schema && (_jsx("span", { class: "param-type", children: _jsx(SchemaDatatype, { schema: param.schema }) })), param.required && _jsx(RequiredBadge, {}), param.deprecated && _jsx(DeprecatedBadge, {}), _jsx("span", { class: "param-in", children: param.in })] }), param.description && (_jsx("div", { class: "param-description", children: _jsx(Markdown, { content: param.description, class: "prose-sm" }) }))] }, `${param.in}-${param.name}`))) }));
|
|
9
9
|
}
|
package/dist/config.d.ts
CHANGED
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,CAAC;AAE9D,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,MAAM,CAAC,EAAE;QACP,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF,MAAM,CAAC,EAAE;QACP,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,GAAG;QACd,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6DAA6D;IAC7D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sHAAsH;IACtH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iJAAiJ;IACjJ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,EAAE;QACV,IAA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W,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,YAAY,EAAE,CAAC;CACvB;AAsBD,wBAAsB,UAAU,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAwBtE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,CAiB/D;AAMD,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CA0BzG;AA0KD,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED,wEAAwE;AACxE,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAI7D;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAO5C"}
|
package/dist/config.js
CHANGED
|
@@ -12,10 +12,9 @@ const DEFAULT_COLORS = {
|
|
|
12
12
|
light: "129 140 248",
|
|
13
13
|
dark: "79 70 229",
|
|
14
14
|
};
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
15
|
+
const DEFAULT_FONT_SANS = "Inter";
|
|
16
|
+
const SYSTEM_SANS = "ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif";
|
|
17
|
+
const SYSTEM_MONO = "ui-monospace, 'SF Mono', 'Cascadia Code', Consolas, 'Liberation Mono', Menlo, monospace";
|
|
19
18
|
const DEFAULT_LAYOUT = {
|
|
20
19
|
sidebar: "18rem",
|
|
21
20
|
toc: "19rem",
|
|
@@ -51,7 +50,7 @@ export function configFromSpec(specPath) {
|
|
|
51
50
|
theme: {
|
|
52
51
|
preset: "default",
|
|
53
52
|
colors: { ...DEFAULT_COLORS },
|
|
54
|
-
fonts: {
|
|
53
|
+
fonts: { sans: `'${DEFAULT_FONT_SANS}', ${SYSTEM_SANS}`, mono: SYSTEM_MONO, googleFont: DEFAULT_FONT_SANS },
|
|
55
54
|
layout: { ...DEFAULT_LAYOUT },
|
|
56
55
|
css: [],
|
|
57
56
|
},
|
|
@@ -105,15 +104,12 @@ function resolveTheme(raw, configDir) {
|
|
|
105
104
|
dark: rawColors.dark ? hexToRgb(rawColors.dark) : hexToRgb(rawColors.primary),
|
|
106
105
|
}
|
|
107
106
|
: { ...DEFAULT_COLORS };
|
|
108
|
-
const
|
|
109
|
-
const
|
|
107
|
+
const sansName = raw.theme?.fonts?.sans ?? DEFAULT_FONT_SANS;
|
|
108
|
+
const monoName = raw.theme?.fonts?.mono;
|
|
110
109
|
const fonts = {
|
|
111
|
-
sans:
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
mono: userMono
|
|
115
|
-
? `'${userMono}', 'SF Mono', 'Fira Code', Consolas, monospace`
|
|
116
|
-
: DEFAULT_FONTS.mono,
|
|
110
|
+
sans: `'${sansName}', ${SYSTEM_SANS}`,
|
|
111
|
+
mono: monoName ? `'${monoName}', ${SYSTEM_MONO}` : SYSTEM_MONO,
|
|
112
|
+
googleFont: sansName,
|
|
117
113
|
};
|
|
118
114
|
const layout = {
|
|
119
115
|
sidebar: raw.theme?.layout?.sidebar ?? DEFAULT_LAYOUT.sidebar,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-loader.d.ts","sourceRoot":"","sources":["../../src/core/markdown-loader.ts"],"names":[],"mappings":"AAKA,OAAO,EAKL,KAAK,WAAW,EACjB,MAAM,sBAAsB,CAAC;AAM9B,MAAM,WAAW,YAAY;IAC3B,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,qDAAqD;IACrD,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,sEAAsE;IACtE,UAAU,EAAE,MAAM,CAAC;IACnB,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,YAAY,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"markdown-loader.d.ts","sourceRoot":"","sources":["../../src/core/markdown-loader.ts"],"names":[],"mappings":"AAKA,OAAO,EAKL,KAAK,WAAW,EACjB,MAAM,sBAAsB,CAAC;AAM9B,MAAM,WAAW,YAAY;IAC3B,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,qDAAqD;IACrD,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,sEAAsE;IACtE,UAAU,EAAE,MAAM,CAAC;IACnB,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,YAAY,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAuoCxD;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,YAAY,CAAC,CA6BvB;AAUD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAIrD"}
|
|
@@ -18,6 +18,10 @@ function parseFrontmatter(raw) {
|
|
|
18
18
|
}
|
|
19
19
|
const FENCED_BLOCK_TOKEN = "@@SOURCEY_FENCED_BLOCK_";
|
|
20
20
|
const INLINE_CODE_TOKEN = "@@SOURCEY_INLINE_CODE_";
|
|
21
|
+
/** Current page's protected fence blocks — used to restore placeholders in JSX children. */
|
|
22
|
+
let activeFenceBlocks = [];
|
|
23
|
+
/** Current page's protected inline code spans — used to restore placeholders in JSX children. */
|
|
24
|
+
let activeInlineSpans = [];
|
|
21
25
|
function protectFencedCodeBlocks(input) {
|
|
22
26
|
const blocks = [];
|
|
23
27
|
const output = [];
|
|
@@ -78,6 +82,14 @@ function protectInlineCodeSpans(input) {
|
|
|
78
82
|
break;
|
|
79
83
|
}
|
|
80
84
|
const span = input.slice(i, closeIndex + delimiter.length);
|
|
85
|
+
// If the content between delimiters spans multiple lines, it's a fenced
|
|
86
|
+
// code block (or block-level backticks), not an inline code span — skip it.
|
|
87
|
+
const inner = input.slice(tickEnd, closeIndex);
|
|
88
|
+
if (inner.includes("\n")) {
|
|
89
|
+
output += input[i];
|
|
90
|
+
i += 1;
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
81
93
|
const index = spans.push(span) - 1;
|
|
82
94
|
output += `${INLINE_CODE_TOKEN}${index}@@`;
|
|
83
95
|
i = closeIndex + delimiter.length;
|
|
@@ -182,6 +194,7 @@ const SUPPORTED_COMPONENT_TAGS = new Set([
|
|
|
182
194
|
"Card",
|
|
183
195
|
"AccordionGroup",
|
|
184
196
|
"Accordion",
|
|
197
|
+
"Expandable",
|
|
185
198
|
"Tabs",
|
|
186
199
|
"Tab",
|
|
187
200
|
"CodeGroup",
|
|
@@ -203,10 +216,29 @@ function buildDirectiveAttrList(entries) {
|
|
|
203
216
|
return attrs.length > 0 ? `{${attrs.join(" ")}}` : "";
|
|
204
217
|
}
|
|
205
218
|
function indentBlock(text, prefix) {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
219
|
+
const lines = text.split("\n");
|
|
220
|
+
const result = [];
|
|
221
|
+
let fence = null;
|
|
222
|
+
for (const line of lines) {
|
|
223
|
+
if (fence) {
|
|
224
|
+
// Inside a fenced code block — don't indent
|
|
225
|
+
result.push(line);
|
|
226
|
+
if (closesFence(line, fence))
|
|
227
|
+
fence = null;
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
const nextFence = isFenceStart(line);
|
|
231
|
+
if (nextFence) {
|
|
232
|
+
// Fence opener — don't indent so markdown recognises it
|
|
233
|
+
fence = nextFence;
|
|
234
|
+
result.push(line);
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
result.push(`${prefix}${line}`);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return result.join("\n");
|
|
210
242
|
}
|
|
211
243
|
function isWhitespaceOnlyText(node) {
|
|
212
244
|
return node.kind === "text" && node.value.trim() === "";
|
|
@@ -367,72 +399,134 @@ function collectChildComponents(children, expected) {
|
|
|
367
399
|
}
|
|
368
400
|
return matches;
|
|
369
401
|
}
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
402
|
+
/**
|
|
403
|
+
* Render the raw text content of parsed component children through the full
|
|
404
|
+
* markdown pipeline (component preprocessing → directive preprocessing →
|
|
405
|
+
* markdown rendering). Strips common leading whitespace first so that
|
|
406
|
+
* indented JSX content (e.g. code fences inside <Step>) is handled correctly.
|
|
407
|
+
*/
|
|
408
|
+
function renderComponentChildrenToHtml(children) {
|
|
409
|
+
let raw = renderParsedComponentNodes(children);
|
|
410
|
+
raw = restoreFencedCodeBlocks(raw, activeFenceBlocks);
|
|
411
|
+
raw = restoreInlineCodeSpans(raw, activeInlineSpans);
|
|
412
|
+
return renderDirectiveMarkdown(dedent(raw));
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Strip common leading whitespace from a block of text.
|
|
416
|
+
*/
|
|
417
|
+
function dedent(text) {
|
|
418
|
+
const lines = text.split("\n");
|
|
419
|
+
const nonEmpty = lines.filter((l) => l.trim().length > 0);
|
|
420
|
+
if (nonEmpty.length === 0)
|
|
421
|
+
return text;
|
|
422
|
+
const indent = Math.min(...nonEmpty.map((l) => l.match(/^(\s*)/)?.[1].length ?? 0));
|
|
423
|
+
if (indent === 0)
|
|
424
|
+
return text;
|
|
425
|
+
return lines.map((l) => l.slice(indent)).join("\n");
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Render an accordion from a parsed JSX component directly to HTML.
|
|
429
|
+
*/
|
|
430
|
+
function renderComponentAccordion(node) {
|
|
431
|
+
const title = renderMarkdownInline(node.attrs.title || "").trim();
|
|
432
|
+
const body = renderComponentChildrenToHtml(node.children);
|
|
433
|
+
return `<details class="accordion-item">
|
|
434
|
+
<summary class="accordion-trigger">${title}</summary>
|
|
435
|
+
<div class="accordion-content">
|
|
436
|
+
${body}
|
|
437
|
+
</div>
|
|
438
|
+
</details>`;
|
|
374
439
|
}
|
|
440
|
+
/**
|
|
441
|
+
* Render a parsed JSX component directly to final HTML.
|
|
442
|
+
* Returns null if the component structure is invalid (falls back to raw text).
|
|
443
|
+
*/
|
|
375
444
|
function renderParsedComponentElement(node) {
|
|
376
445
|
if (node.name === "Steps") {
|
|
377
446
|
const steps = collectChildComponents(node.children, "Step");
|
|
378
447
|
if (!steps)
|
|
379
448
|
return null;
|
|
380
|
-
const
|
|
449
|
+
const items = steps
|
|
381
450
|
.map((step, index) => {
|
|
382
|
-
const title = step.attrs.title || "";
|
|
383
|
-
const
|
|
384
|
-
return
|
|
451
|
+
const title = renderMarkdownInline(step.attrs.title || "").trim();
|
|
452
|
+
const body = renderComponentChildrenToHtml(step.children);
|
|
453
|
+
return `<div role="listitem" class="step-item">
|
|
454
|
+
<div class="step-number">${index + 1}</div>
|
|
455
|
+
<div class="step-body">
|
|
456
|
+
<p class="step-title">${title}</p>
|
|
457
|
+
<div class="step-content">
|
|
458
|
+
${body}
|
|
459
|
+
</div>
|
|
460
|
+
</div>
|
|
461
|
+
</div>`;
|
|
385
462
|
})
|
|
386
463
|
.join("\n");
|
|
387
|
-
return
|
|
464
|
+
return `\n\n<div role="list" class="steps not-prose">\n${items}\n</div>\n`;
|
|
388
465
|
}
|
|
389
466
|
if (node.name === "CardGroup") {
|
|
390
467
|
const cards = collectChildComponents(node.children, "Card");
|
|
391
468
|
if (!cards)
|
|
392
469
|
return null;
|
|
393
|
-
const
|
|
470
|
+
const cols = node.attrs.cols || "2";
|
|
471
|
+
const cardHtml = cards
|
|
394
472
|
.map((card) => {
|
|
395
|
-
const
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
473
|
+
const tag = card.attrs.href ? "a" : "div";
|
|
474
|
+
const href = card.attrs.href ? ` href="${escapeHtmlAttr(card.attrs.href)}"` : "";
|
|
475
|
+
const iconHtml = renderIcon(card.attrs.icon || "");
|
|
476
|
+
const title = renderMarkdownInline(card.attrs.title || "").trim();
|
|
477
|
+
const body = renderComponentChildrenToHtml(card.children);
|
|
478
|
+
return `<${tag}${href} class="card-item">
|
|
479
|
+
<div class="card-item-inner">
|
|
480
|
+
${iconHtml}
|
|
481
|
+
<h3 class="card-item-title">${title}</h3>
|
|
482
|
+
<div class="card-item-content">
|
|
483
|
+
${body}
|
|
484
|
+
</div>
|
|
485
|
+
</div>
|
|
486
|
+
</${tag}>`;
|
|
402
487
|
})
|
|
403
488
|
.join("\n");
|
|
404
|
-
return
|
|
489
|
+
return `\n\n<div class="card-group not-prose" data-cols="${escapeHtmlAttr(cols)}">\n${cardHtml}\n</div>\n`;
|
|
405
490
|
}
|
|
406
491
|
if (node.name === "AccordionGroup") {
|
|
407
492
|
const accordions = collectChildComponents(node.children, "Accordion");
|
|
408
493
|
if (!accordions)
|
|
409
494
|
return null;
|
|
410
|
-
return accordions.map(
|
|
495
|
+
return `\n\n<div class="accordion-group not-prose">\n${accordions.map(renderComponentAccordion).join("\n")}\n</div>\n`;
|
|
411
496
|
}
|
|
412
|
-
if (node.name === "Accordion") {
|
|
413
|
-
return
|
|
497
|
+
if (node.name === "Accordion" || node.name === "Expandable") {
|
|
498
|
+
return `\n\n${renderComponentAccordion(node)}\n`;
|
|
414
499
|
}
|
|
415
500
|
if (node.name === "Tabs") {
|
|
416
501
|
const tabs = collectChildComponents(node.children, "Tab");
|
|
417
502
|
if (!tabs)
|
|
418
503
|
return null;
|
|
419
|
-
const
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
}
|
|
424
|
-
.join("\n");
|
|
425
|
-
return `:::tabs\n${body}\n:::`;
|
|
504
|
+
const tabData = tabs.map((tab) => ({
|
|
505
|
+
title: renderMarkdownInline(tab.attrs.title || "").trim(),
|
|
506
|
+
body: renderComponentChildrenToHtml(tab.children),
|
|
507
|
+
}));
|
|
508
|
+
return `\n\n${buildTabbedHtml(tabData, nextId("tabs"))}\n`;
|
|
426
509
|
}
|
|
427
510
|
if (node.name === "CodeGroup") {
|
|
428
|
-
|
|
429
|
-
|
|
511
|
+
let cgRaw = renderParsedComponentNodes(node.children);
|
|
512
|
+
cgRaw = restoreFencedCodeBlocks(cgRaw, activeFenceBlocks);
|
|
513
|
+
cgRaw = restoreInlineCodeSpans(cgRaw, activeInlineSpans);
|
|
514
|
+
const codeBlocks = parseTitledCodeBlocks(dedent(cgRaw)).map((block) => ({
|
|
515
|
+
title: renderMarkdownInline(block.title).trim(),
|
|
516
|
+
body: renderCodeBlock(block.body, block.lang),
|
|
517
|
+
}));
|
|
518
|
+
if (codeBlocks.length === 0)
|
|
519
|
+
return null;
|
|
520
|
+
return `\n\n${buildTabbedHtml(codeBlocks, nextId("cg"), "directive-code-group")}\n`;
|
|
430
521
|
}
|
|
431
522
|
if (node.name === "Note" || node.name === "Warning" || node.name === "Tip" || node.name === "Info") {
|
|
432
|
-
const
|
|
433
|
-
const
|
|
434
|
-
const
|
|
435
|
-
return
|
|
523
|
+
const type = node.name.toLowerCase();
|
|
524
|
+
const label = renderMarkdownInline(node.attrs.title?.trim() || node.name.charAt(0).toUpperCase() + node.name.slice(1)).trim();
|
|
525
|
+
const body = renderComponentChildrenToHtml(node.children);
|
|
526
|
+
return `\n\n<div class="callout callout-${type} not-prose">
|
|
527
|
+
<div class="callout-title">${label}</div>
|
|
528
|
+
${body ? `<div class="callout-content">\n${body}\n</div>` : ""}
|
|
529
|
+
</div>\n`;
|
|
436
530
|
}
|
|
437
531
|
if (node.name === "Video") {
|
|
438
532
|
const titleAttr = node.attrs.title ? `{title="${escapeDirectiveAttr(node.attrs.title)}"}` : "";
|
|
@@ -458,7 +552,9 @@ function renderParsedComponentNode(node) {
|
|
|
458
552
|
*/
|
|
459
553
|
function preprocessComponents(body) {
|
|
460
554
|
const { text: fencedText, blocks } = protectFencedCodeBlocks(body);
|
|
555
|
+
activeFenceBlocks = blocks;
|
|
461
556
|
const { text, spans } = protectInlineCodeSpans(fencedText);
|
|
557
|
+
activeInlineSpans = spans;
|
|
462
558
|
const parsed = parseComponentNodes(text);
|
|
463
559
|
const restoredInline = restoreInlineCodeSpans(renderParsedComponentNodes(parsed.nodes), spans);
|
|
464
560
|
return restoreFencedCodeBlocks(restoredInline, blocks);
|
|
@@ -585,7 +681,7 @@ function parseTitledCodeBlocks(content) {
|
|
|
585
681
|
let i = 0;
|
|
586
682
|
while (i < lines.length) {
|
|
587
683
|
const line = stripDirectiveIndent(lines[i]).trimEnd();
|
|
588
|
-
const open = line.match(/^(`{3,}|~{3,})(\S+)?(?:\s+title="([^"]*)")?\s*$/);
|
|
684
|
+
const open = line.match(/^(`{3,}|~{3,})(\S+)?(?:\s+title="([^"]*)"|\s+(.+?))?\s*$/);
|
|
589
685
|
if (!open) {
|
|
590
686
|
i += 1;
|
|
591
687
|
continue;
|
|
@@ -597,7 +693,7 @@ function parseTitledCodeBlocks(content) {
|
|
|
597
693
|
if (j >= lines.length)
|
|
598
694
|
break;
|
|
599
695
|
blocks.push({
|
|
600
|
-
title: open[3] ?? "",
|
|
696
|
+
title: open[3] ?? open[4] ?? "",
|
|
601
697
|
lang: open[2] ?? "",
|
|
602
698
|
body: lines.slice(i + 1, j).join("\n"),
|
|
603
699
|
});
|
|
@@ -71,6 +71,6 @@
|
|
|
71
71
|
--method-prompt: #2563eb;
|
|
72
72
|
|
|
73
73
|
/* Typography */
|
|
74
|
-
--font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
|
74
|
+
--font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
|
75
75
|
--font-mono: ui-monospace, 'SF Mono', 'Cascadia Code', Consolas, 'Liberation Mono', Menlo, monospace;
|
|
76
76
|
}
|
|
@@ -218,8 +218,8 @@ h1[id], h2[id], h3[id], h4[id], h5[id], h6[id] {
|
|
|
218
218
|
/* ── Nav Links ────────────────────────────────────────────────────── */
|
|
219
219
|
|
|
220
220
|
#sourcey .nav-group-label {
|
|
221
|
-
padding: 0
|
|
222
|
-
margin-bottom: 0.
|
|
221
|
+
padding: 0 0.75rem 0.25rem 1rem;
|
|
222
|
+
margin-bottom: 0.625rem;
|
|
223
223
|
font-size: inherit;
|
|
224
224
|
font-weight: 600;
|
|
225
225
|
color: rgb(var(--color-gray-900));
|
|
@@ -244,13 +244,13 @@ h1[id], h2[id], h3[id], h4[id], h5[id], h6[id] {
|
|
|
244
244
|
#sourcey .nav-link {
|
|
245
245
|
display: flex;
|
|
246
246
|
align-items: flex-start;
|
|
247
|
-
padding: 0.
|
|
247
|
+
padding: 0.375rem 0.75rem 0.375rem 1rem;
|
|
248
248
|
gap: 0.75rem;
|
|
249
249
|
cursor: pointer;
|
|
250
250
|
text-align: left;
|
|
251
251
|
overflow-wrap: break-word;
|
|
252
252
|
hyphens: auto;
|
|
253
|
-
border-radius: 0.
|
|
253
|
+
border-radius: 0.75rem;
|
|
254
254
|
width: 100%;
|
|
255
255
|
color: rgb(var(--color-gray-700));
|
|
256
256
|
transition: color 0.15s, background-color 0.15s;
|
|
@@ -269,7 +269,7 @@ h1[id], h2[id], h3[id], h4[id], h5[id], h6[id] {
|
|
|
269
269
|
#sourcey .nav-link.active {
|
|
270
270
|
color: rgb(var(--color-primary-ink));
|
|
271
271
|
background: rgb(var(--color-primary) / 0.08);
|
|
272
|
-
|
|
272
|
+
text-shadow: -0.2px 0 0 currentColor, 0.2px 0 0 currentColor;
|
|
273
273
|
}
|
|
274
274
|
.dark #sourcey .nav-link.active {
|
|
275
275
|
color: rgb(var(--color-primary-light));
|
|
@@ -293,6 +293,7 @@ h1[id], h2[id], h3[id], h4[id], h5[id], h6[id] {
|
|
|
293
293
|
#sourcey #toc .toc-item.active {
|
|
294
294
|
color: rgb(var(--color-primary-ink));
|
|
295
295
|
border-left-color: rgb(var(--color-primary-ink));
|
|
296
|
+
font-weight: 500;
|
|
296
297
|
}
|
|
297
298
|
.dark #sourcey #toc .toc-item.active {
|
|
298
299
|
color: rgb(var(--color-primary-light));
|
|
@@ -577,9 +578,6 @@ h1[id], h2[id], h3[id], h4[id], h5[id], h6[id] {
|
|
|
577
578
|
color: rgb(var(--color-gray-400));
|
|
578
579
|
}
|
|
579
580
|
|
|
580
|
-
#sourcey .param-description p {
|
|
581
|
-
margin-bottom: 0.25rem;
|
|
582
|
-
}
|
|
583
581
|
|
|
584
582
|
/* ── Steps (numbered step list with vertical connector) ────────────── */
|
|
585
583
|
|