starlight-cannoli-plugins 2.4.0 → 2.5.1
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/{chunk-FQLJMU2J.js → chunk-3UMY7T6G.js} +7 -16
- package/dist/chunk-FQJ4IIDT.js +49 -0
- package/dist/chunk-LJWSZSPB.js +35 -0
- package/dist/{chunk-IFQMZ5HP.js → chunk-TLOFSB33.js} +8 -9
- package/dist/index.d.ts +4 -2
- package/dist/index.js +11 -3
- package/dist/plugins/astro-latex-compile.d.ts +1 -1
- package/dist/plugins/astro-latex-compile.js +1 -1
- package/dist/plugins/astro-normalize-paths.d.ts +1 -1
- package/dist/plugins/astro-normalize-paths.js +4 -5
- package/dist/plugins/expressive-code-emphasis.d.ts +5 -0
- package/dist/plugins/expressive-code-emphasis.js +7 -0
- package/dist/plugins/rehype-validate-links.d.ts +1 -1
- package/dist/plugins/rehype-validate-links.js +3 -4
- package/dist/styles/_starlight.scss +7 -0
- package/package.json +6 -1
- package/dist/{angular-ts-WMP65SON.js → angular-ts-7RL6HMZA.js} +3 -3
- package/dist/{gdresource-NUFTOCJI.js → gdresource-4KLMUJAA.js} +3 -3
- package/dist/{mdc-O4TTCGRP.js → mdc-RDDN747Z.js} +3 -3
|
@@ -1,20 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PROJECT_DOCS_DIR,
|
|
3
|
+
matchesGlobPatterns
|
|
4
|
+
} from "./chunk-LJWSZSPB.js";
|
|
5
|
+
|
|
1
6
|
// src/plugins/rehype-validate-links.ts
|
|
2
7
|
import { existsSync } from "fs";
|
|
3
8
|
import { sync as globSync } from "glob";
|
|
4
9
|
import { dirname, join, relative, resolve } from "path";
|
|
5
10
|
import { visit } from "unist-util-visit";
|
|
6
|
-
|
|
7
|
-
// src/plugins/utils/path-utils.ts
|
|
8
|
-
import { minimatch } from "minimatch";
|
|
9
|
-
var PROJECT_DOCS_DIR = "src/content/docs";
|
|
10
|
-
function matchesSkipPattern(path, patterns) {
|
|
11
|
-
if (!patterns || patterns.length === 0) {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
return patterns.some((pattern) => minimatch(path, pattern));
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// src/plugins/rehype-validate-links.ts
|
|
18
11
|
function getResolvedLink(href, currentFilePath) {
|
|
19
12
|
let skipValidation = false;
|
|
20
13
|
let processedHref = href;
|
|
@@ -102,7 +95,7 @@ function rehypeValidateLinks(options) {
|
|
|
102
95
|
if (!link) return;
|
|
103
96
|
if (link.skipValidation) return;
|
|
104
97
|
if (node.properties?.["data-no-link-check"] !== void 0) return;
|
|
105
|
-
if (
|
|
98
|
+
if (matchesGlobPatterns(link.site_absolute_href, options?.skipPatterns))
|
|
106
99
|
return;
|
|
107
100
|
const error = validateLink(link);
|
|
108
101
|
if (error) errors.push(error);
|
|
@@ -115,9 +108,7 @@ function rehypeValidateLinks(options) {
|
|
|
115
108
|
}
|
|
116
109
|
};
|
|
117
110
|
}
|
|
118
|
-
var rehype_validate_links_default = rehypeValidateLinks;
|
|
119
111
|
|
|
120
112
|
export {
|
|
121
|
-
rehypeValidateLinks
|
|
122
|
-
rehype_validate_links_default
|
|
113
|
+
rehypeValidateLinks
|
|
123
114
|
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// src/plugins/expressive-code-emphasis/index.ts
|
|
2
|
+
import {
|
|
3
|
+
definePlugin,
|
|
4
|
+
ExpressiveCodeAnnotation
|
|
5
|
+
} from "@expressive-code/core";
|
|
6
|
+
import { h } from "@expressive-code/core/hast";
|
|
7
|
+
var EmphasisAnnotation = class extends ExpressiveCodeAnnotation {
|
|
8
|
+
render({ nodesToTransform }) {
|
|
9
|
+
return nodesToTransform.map((node) => h("span.bold-supreme", [node]));
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
function parseEmphTerms(meta) {
|
|
13
|
+
const match = meta.match(/\bemph="([^"]+)"/);
|
|
14
|
+
if (!match) return [];
|
|
15
|
+
return match[1].split(",").map((t) => t.trim()).filter(Boolean);
|
|
16
|
+
}
|
|
17
|
+
function expressiveCodeEmphasis() {
|
|
18
|
+
return definePlugin({
|
|
19
|
+
name: "expressiveCodeEmphasis",
|
|
20
|
+
hooks: {
|
|
21
|
+
preprocessCode: (context) => {
|
|
22
|
+
const terms = parseEmphTerms(context.codeBlock.meta);
|
|
23
|
+
if (terms.length === 0) return;
|
|
24
|
+
for (const line of context.codeBlock.getLines()) {
|
|
25
|
+
for (const term of terms) {
|
|
26
|
+
let searchFrom = 0;
|
|
27
|
+
while (true) {
|
|
28
|
+
const index = line.text.indexOf(term, searchFrom);
|
|
29
|
+
if (index === -1) break;
|
|
30
|
+
line.addAnnotation(
|
|
31
|
+
new EmphasisAnnotation({
|
|
32
|
+
inlineRange: {
|
|
33
|
+
columnStart: index,
|
|
34
|
+
columnEnd: index + term.length
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
);
|
|
38
|
+
searchFrom = index + term.length;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export {
|
|
48
|
+
expressiveCodeEmphasis
|
|
49
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// src/plugins/utils/path-utils.ts
|
|
2
|
+
import { minimatch } from "minimatch";
|
|
3
|
+
var PROJECT_DOCS_DIR = "src/content/docs";
|
|
4
|
+
var EXTERNAL_SCHEMES = [
|
|
5
|
+
"http://",
|
|
6
|
+
"https://",
|
|
7
|
+
"ftp://",
|
|
8
|
+
"ftps://",
|
|
9
|
+
"sftp://",
|
|
10
|
+
"ssh://",
|
|
11
|
+
"git://",
|
|
12
|
+
"svn://",
|
|
13
|
+
"irc://",
|
|
14
|
+
"ircs://",
|
|
15
|
+
"ws://",
|
|
16
|
+
"wss://"
|
|
17
|
+
];
|
|
18
|
+
function isExternalPath(path) {
|
|
19
|
+
return EXTERNAL_SCHEMES.some((scheme) => path.startsWith(scheme));
|
|
20
|
+
}
|
|
21
|
+
function isRelativePath(path) {
|
|
22
|
+
return !isExternalPath(path) && !path.startsWith("/") && !path.startsWith("data:") && !path.startsWith("#");
|
|
23
|
+
}
|
|
24
|
+
function matchesGlobPatterns(path, patterns) {
|
|
25
|
+
if (!patterns || patterns.length === 0) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
return patterns.some((pattern) => minimatch(path, pattern));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export {
|
|
32
|
+
PROJECT_DOCS_DIR,
|
|
33
|
+
isRelativePath,
|
|
34
|
+
matchesGlobPatterns
|
|
35
|
+
};
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PROJECT_DOCS_DIR,
|
|
3
|
+
isRelativePath
|
|
4
|
+
} from "./chunk-LJWSZSPB.js";
|
|
5
|
+
|
|
1
6
|
// src/plugins/astro-normalize-paths/index.ts
|
|
2
7
|
import { existsSync } from "fs";
|
|
3
8
|
import { readFile, writeFile } from "fs/promises";
|
|
@@ -32,7 +37,6 @@ var LinkElement = class {
|
|
|
32
37
|
return element.getAttribute(this._accessor) ?? "";
|
|
33
38
|
}
|
|
34
39
|
};
|
|
35
|
-
var SRC_CONTENT_ROOT = "src/content/docs/";
|
|
36
40
|
function astroNormalizePaths() {
|
|
37
41
|
return {
|
|
38
42
|
name: "astro-normalize-paths",
|
|
@@ -73,7 +77,7 @@ function getLinks(document) {
|
|
|
73
77
|
}
|
|
74
78
|
function resolveSourceFile(htmlFilePath, distRoot) {
|
|
75
79
|
const normalizedDistDir = distRoot.replace(/\/+$/, "");
|
|
76
|
-
const srcDir =
|
|
80
|
+
const srcDir = PROJECT_DOCS_DIR.replace(/\/+$/, "");
|
|
77
81
|
const relativeHtmlPath = htmlFilePath.slice(normalizedDistDir.length).replace(/^\/+/, "");
|
|
78
82
|
if (relativeHtmlPath !== "index.html" && !relativeHtmlPath.endsWith("/index.html")) {
|
|
79
83
|
throw new Error(
|
|
@@ -115,16 +119,11 @@ function normalizeAssetPath(relLinkHref, sourceFilePath) {
|
|
|
115
119
|
}
|
|
116
120
|
const absoluteLinkedPath = resolve(dirname(sourceFilePath), href);
|
|
117
121
|
const relToRoot = relative(process.cwd(), absoluteLinkedPath);
|
|
118
|
-
const srcContentRoot =
|
|
122
|
+
const srcContentRoot = PROJECT_DOCS_DIR.replace(/\/+$/, "");
|
|
119
123
|
const relToContentRoot = relToRoot.startsWith(srcContentRoot) ? relToRoot.slice(srcContentRoot.length).replace(/^\/+/, "") : relToRoot;
|
|
120
124
|
return "/" + relToContentRoot.replace(/\\/g, "/") + suffix;
|
|
121
125
|
}
|
|
122
|
-
function isRelativePath(path) {
|
|
123
|
-
return !path.startsWith("/") && !path.startsWith("http://") && !path.startsWith("https://") && !path.startsWith("data:") && !path.startsWith("#") && !path.startsWith("mailto:");
|
|
124
|
-
}
|
|
125
|
-
var astro_normalize_paths_default = astroNormalizePaths;
|
|
126
126
|
|
|
127
127
|
export {
|
|
128
|
-
astroNormalizePaths
|
|
129
|
-
astro_normalize_paths_default
|
|
128
|
+
astroNormalizePaths
|
|
130
129
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
export { starlightIndexOnlySidebar } from './plugins/starlight-index-only-sidebar.js';
|
|
2
2
|
export { DomPatchesOptions, starlightDomPatches } from './plugins/starlight-dom-patches.js';
|
|
3
3
|
export { SyncDocsToPublicOptions, syncDocsToPublic } from './plugins/astro-sync-docs-to-public.js';
|
|
4
|
-
export {
|
|
4
|
+
export { rehypeValidateLinks } from './plugins/rehype-validate-links.js';
|
|
5
5
|
export { astroNormalizePaths } from './plugins/astro-normalize-paths.js';
|
|
6
6
|
import { RemarkLatexCompileOptions } from './plugins/astro-latex-compile.js';
|
|
7
|
-
export {
|
|
7
|
+
export { remarkLatexCompile } from './plugins/astro-latex-compile.js';
|
|
8
|
+
export { expressiveCodeEmphasis } from './plugins/expressive-code-emphasis.js';
|
|
8
9
|
import { AstroIntegration } from 'astro';
|
|
9
10
|
import '@astrojs/starlight/types';
|
|
10
11
|
import 'hast';
|
|
11
12
|
import 'vfile';
|
|
12
13
|
import 'mdast';
|
|
14
|
+
import 'expressive-code';
|
|
13
15
|
|
|
14
16
|
interface LatexCompileOptions extends RemarkLatexCompileOptions {
|
|
15
17
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
expressiveCodeEmphasis
|
|
3
|
+
} from "./chunk-FQJ4IIDT.js";
|
|
1
4
|
import {
|
|
2
5
|
starlightIndexOnlySidebar
|
|
3
6
|
} from "./chunk-N2I2GJW3.js";
|
|
4
7
|
import {
|
|
5
8
|
rehypeValidateLinks
|
|
6
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-3UMY7T6G.js";
|
|
7
10
|
import {
|
|
8
11
|
remarkLatexCompile
|
|
9
12
|
} from "./chunk-XVMRLEQM.js";
|
|
10
13
|
import {
|
|
11
14
|
astroNormalizePaths
|
|
12
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-TLOFSB33.js";
|
|
16
|
+
import "./chunk-LJWSZSPB.js";
|
|
13
17
|
import {
|
|
14
18
|
syncDocsToPublic
|
|
15
19
|
} from "./chunk-WZNJ5VFU.js";
|
|
@@ -52,7 +56,10 @@ function astroLatexCompile(options) {
|
|
|
52
56
|
};
|
|
53
57
|
updateConfig({
|
|
54
58
|
markdown: {
|
|
55
|
-
remarkPlugins: [
|
|
59
|
+
remarkPlugins: [
|
|
60
|
+
...existingPlugins,
|
|
61
|
+
[remarkLatexCompile, remarkOptions]
|
|
62
|
+
]
|
|
56
63
|
}
|
|
57
64
|
});
|
|
58
65
|
},
|
|
@@ -83,6 +90,7 @@ function astroLatexCompile(options) {
|
|
|
83
90
|
export {
|
|
84
91
|
astroLatexCompile,
|
|
85
92
|
astroNormalizePaths,
|
|
93
|
+
expressiveCodeEmphasis,
|
|
86
94
|
rehypeValidateLinks,
|
|
87
95
|
remarkLatexCompile,
|
|
88
96
|
starlightDomPatches,
|
|
@@ -35,4 +35,4 @@ interface RemarkLatexCompileOptions {
|
|
|
35
35
|
}
|
|
36
36
|
declare function remarkLatexCompile(options: RemarkLatexCompileOptions): (tree: Root, file: VFile) => Promise<void>;
|
|
37
37
|
|
|
38
|
-
export { type RemarkLatexCompileOptions, compileLatexToSvg, remarkLatexCompile
|
|
38
|
+
export { type RemarkLatexCompileOptions, compileLatexToSvg, remarkLatexCompile };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
-
astroNormalizePaths
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
astroNormalizePaths
|
|
3
|
+
} from "../chunk-TLOFSB33.js";
|
|
4
|
+
import "../chunk-LJWSZSPB.js";
|
|
5
5
|
import "../chunk-QGM4M3NI.js";
|
|
6
6
|
export {
|
|
7
|
-
astroNormalizePaths
|
|
8
|
-
astro_normalize_paths_default as default
|
|
7
|
+
astroNormalizePaths
|
|
9
8
|
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
-
rehypeValidateLinks
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
rehypeValidateLinks
|
|
3
|
+
} from "../chunk-3UMY7T6G.js";
|
|
4
|
+
import "../chunk-LJWSZSPB.js";
|
|
5
5
|
import "../chunk-QGM4M3NI.js";
|
|
6
6
|
export {
|
|
7
|
-
rehype_validate_links_default as default,
|
|
8
7
|
rehypeValidateLinks
|
|
9
8
|
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@import url("https://fonts.googleapis.com/css2?family=Open+Sans:wght@700;800&display=swap");
|
|
2
|
+
|
|
1
3
|
/********** Starlight Overrides **********/
|
|
2
4
|
|
|
3
5
|
.sl-container:where(.astro-7nkwcw3z) {
|
|
@@ -60,6 +62,11 @@ starlight-toc ul > li {
|
|
|
60
62
|
width: 2rem;
|
|
61
63
|
}
|
|
62
64
|
|
|
65
|
+
.bold-supreme {
|
|
66
|
+
font-family: "Open Sans", sans-serif;
|
|
67
|
+
font-weight: 800;
|
|
68
|
+
}
|
|
69
|
+
|
|
63
70
|
/************ Details/Summary Styles ************/
|
|
64
71
|
.main-pane details {
|
|
65
72
|
background: rgba(162, 171, 173, 0.071);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "starlight-cannoli-plugins",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.5.1",
|
|
5
5
|
"description": "Starlight plugins for automatic sidebar generation and link validation",
|
|
6
6
|
"license": "ISC",
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -79,6 +79,7 @@
|
|
|
79
79
|
},
|
|
80
80
|
"peerDependencies": {
|
|
81
81
|
"@astrojs/starlight": ">=0.30.0",
|
|
82
|
+
"@expressive-code/core": ">=0.41.7",
|
|
82
83
|
"astro": ">=5.0.0"
|
|
83
84
|
},
|
|
84
85
|
"peerDependenciesMeta": {
|
|
@@ -87,6 +88,9 @@
|
|
|
87
88
|
},
|
|
88
89
|
"@astrojs/starlight": {
|
|
89
90
|
"optional": true
|
|
91
|
+
},
|
|
92
|
+
"@expressive-code/core": {
|
|
93
|
+
"optional": true
|
|
90
94
|
}
|
|
91
95
|
},
|
|
92
96
|
"overrides": {
|
|
@@ -97,6 +101,7 @@
|
|
|
97
101
|
"@astrojs/starlight": "^0.37.6",
|
|
98
102
|
"@eslint/js": "^10.0.1",
|
|
99
103
|
"@eslint/markdown": "^7.5.1",
|
|
104
|
+
"@expressive-code/core": "^0.41.7",
|
|
100
105
|
"@expressive-code/plugin-line-numbers": "^0.41.7",
|
|
101
106
|
"@hpcc-js/wasm": "^2.33.1",
|
|
102
107
|
"@trivago/prettier-plugin-sort-imports": "^6.0.2",
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
scss_default
|
|
3
|
-
} from "./chunk-3TOTNBUR.js";
|
|
4
1
|
import {
|
|
5
2
|
angular_expression_default,
|
|
6
3
|
angular_html_default,
|
|
@@ -8,6 +5,9 @@ import {
|
|
|
8
5
|
angular_template_blocks_default,
|
|
9
6
|
angular_template_default
|
|
10
7
|
} from "./chunk-VN4MPI3U.js";
|
|
8
|
+
import {
|
|
9
|
+
scss_default
|
|
10
|
+
} from "./chunk-3TOTNBUR.js";
|
|
11
11
|
import "./chunk-L4TNW36O.js";
|
|
12
12
|
import "./chunk-2QHMH6QB.js";
|
|
13
13
|
import "./chunk-MQJVB2GB.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
gdscript_default
|
|
3
|
-
} from "./chunk-YWWGTQZD.js";
|
|
4
1
|
import {
|
|
5
2
|
gdshader_default
|
|
6
3
|
} from "./chunk-45O7TJOW.js";
|
|
4
|
+
import {
|
|
5
|
+
gdscript_default
|
|
6
|
+
} from "./chunk-YWWGTQZD.js";
|
|
7
7
|
import "./chunk-QGM4M3NI.js";
|
|
8
8
|
|
|
9
9
|
// node_modules/@shikijs/langs/dist/gdresource.mjs
|