starlight-dot-md 0.2.0 → 0.2.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/README.md +28 -1
- package/dist/index.mjs +1 -3
- package/dist/slug.md.mjs +2 -4
- package/dist/slug.mdoc.mjs +2 -4
- package/dist/slug.mdx.mjs +2 -4
- package/dist/{utils-C499GJ3Y.mjs → utils-K4BnESpG.mjs} +1 -3
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -2,4 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
A Starlight plugin that serves your docs (.md, .mdx, .mdoc) as raw markdown for AI agents.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
Install the package:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install starlight-dot-md@latest
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Add the plugin to your Astro config:
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
import starlight from "@astrojs/starlight";
|
|
17
|
+
import { defineConfig } from "astro/config";
|
|
18
|
+
import starlightDotMd from "starlight-dot-md";
|
|
19
|
+
|
|
20
|
+
export default defineConfig({
|
|
21
|
+
integrations: [
|
|
22
|
+
starlight({
|
|
23
|
+
// ...
|
|
24
|
+
plugins: [starlightDotMd()],
|
|
25
|
+
}),
|
|
26
|
+
],
|
|
27
|
+
});
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
That's it! You can now access any page's source by appending `.md` to its URL (e.g., for a page at `/guides/example`, access `/guides/example.md`).
|
|
31
|
+
|
|
32
|
+
For more details, see the [documentation](https://starlight-dot-md.shf0811.workers.dev/).
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { readdirSync, statSync } from "node:fs";
|
|
2
2
|
import { join, relative } from "node:path";
|
|
3
|
-
|
|
4
3
|
//#region src/index.ts
|
|
5
4
|
function findFilesByExtension(dir, baseDir, extension) {
|
|
6
5
|
const results = [];
|
|
@@ -80,6 +79,5 @@ function starlightDotMd(options = {}) {
|
|
|
80
79
|
} }
|
|
81
80
|
};
|
|
82
81
|
}
|
|
83
|
-
|
|
84
82
|
//#endregion
|
|
85
|
-
export { starlightDotMd as default };
|
|
83
|
+
export { starlightDotMd as default };
|
package/dist/slug.md.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { a as isMdx, i as isMdoc, n as isExcluded, o as originalSlugFromOutput, r as isIncluded, s as transformSlugForOutput, t as generateMarkdownContent } from "./utils-
|
|
1
|
+
import { a as isMdx, i as isMdoc, n as isExcluded, o as originalSlugFromOutput, r as isIncluded, s as transformSlugForOutput, t as generateMarkdownContent } from "./utils-K4BnESpG.mjs";
|
|
2
2
|
import { getCollection, getEntry } from "astro:content";
|
|
3
3
|
import { context } from "virtual:starlight-dot-md/context";
|
|
4
|
-
|
|
5
4
|
//#region src/slug.md.ts
|
|
6
5
|
function shouldServe(slug) {
|
|
7
6
|
if (!isIncluded(slug) || isExcluded(slug)) return false;
|
|
@@ -23,6 +22,5 @@ const GET = async ({ params }) => {
|
|
|
23
22
|
headers: { "Content-Type": "text/markdown; charset=utf-8" }
|
|
24
23
|
});
|
|
25
24
|
};
|
|
26
|
-
|
|
27
25
|
//#endregion
|
|
28
|
-
export { GET, getStaticPaths };
|
|
26
|
+
export { GET, getStaticPaths };
|
package/dist/slug.mdoc.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { i as isMdoc, n as isExcluded, o as originalSlugFromOutput, r as isIncluded, s as transformSlugForOutput, t as generateMarkdownContent } from "./utils-
|
|
1
|
+
import { i as isMdoc, n as isExcluded, o as originalSlugFromOutput, r as isIncluded, s as transformSlugForOutput, t as generateMarkdownContent } from "./utils-K4BnESpG.mjs";
|
|
2
2
|
import { getCollection, getEntry } from "astro:content";
|
|
3
|
-
|
|
4
3
|
//#region src/slug.mdoc.ts
|
|
5
4
|
function shouldServe(slug) {
|
|
6
5
|
return isMdoc(slug) && isIncluded(slug) && !isExcluded(slug);
|
|
@@ -20,6 +19,5 @@ const GET = async ({ params }) => {
|
|
|
20
19
|
headers: { "Content-Type": "text/markdown; charset=utf-8" }
|
|
21
20
|
});
|
|
22
21
|
};
|
|
23
|
-
|
|
24
22
|
//#endregion
|
|
25
|
-
export { GET, getStaticPaths };
|
|
23
|
+
export { GET, getStaticPaths };
|
package/dist/slug.mdx.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { a as isMdx, n as isExcluded, o as originalSlugFromOutput, r as isIncluded, s as transformSlugForOutput, t as generateMarkdownContent } from "./utils-
|
|
1
|
+
import { a as isMdx, n as isExcluded, o as originalSlugFromOutput, r as isIncluded, s as transformSlugForOutput, t as generateMarkdownContent } from "./utils-K4BnESpG.mjs";
|
|
2
2
|
import { getCollection, getEntry } from "astro:content";
|
|
3
|
-
|
|
4
3
|
//#region src/slug.mdx.ts
|
|
5
4
|
function shouldServe(slug) {
|
|
6
5
|
return isMdx(slug) && isIncluded(slug) && !isExcluded(slug);
|
|
@@ -20,6 +19,5 @@ const GET = async ({ params }) => {
|
|
|
20
19
|
headers: { "Content-Type": "text/markdown; charset=utf-8" }
|
|
21
20
|
});
|
|
22
21
|
};
|
|
23
|
-
|
|
24
22
|
//#endregion
|
|
25
|
-
export { GET, getStaticPaths };
|
|
23
|
+
export { GET, getStaticPaths };
|
|
@@ -2,7 +2,6 @@ import { context } from "virtual:starlight-dot-md/context";
|
|
|
2
2
|
import { mdocSlugs, mdxSlugs } from "virtual:starlight-dot-md/files";
|
|
3
3
|
import picomatch from "picomatch";
|
|
4
4
|
import yaml from "yaml";
|
|
5
|
-
|
|
6
5
|
//#region src/utils.ts
|
|
7
6
|
function isMdx(slug) {
|
|
8
7
|
return mdxSlugs.has(slug);
|
|
@@ -30,6 +29,5 @@ function generateMarkdownContent(entry) {
|
|
|
30
29
|
if (!context.includeFrontmatter) return entry.body ?? "";
|
|
31
30
|
return `---\n${yaml.stringify(entry.data)}---\n\n${entry.body ?? ""}`;
|
|
32
31
|
}
|
|
33
|
-
|
|
34
32
|
//#endregion
|
|
35
|
-
export { isMdx as a, isMdoc as i, isExcluded as n, originalSlugFromOutput as o, isIncluded as r, transformSlugForOutput as s, generateMarkdownContent as t };
|
|
33
|
+
export { isMdx as a, isMdoc as i, isExcluded as n, originalSlugFromOutput as o, isIncluded as r, transformSlugForOutput as s, generateMarkdownContent as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "starlight-dot-md",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "A Starlight plugin that exposes raw markdown files at `.md` URLs.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"astro",
|
|
@@ -34,17 +34,17 @@
|
|
|
34
34
|
"dist"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"picomatch": "4.0.
|
|
38
|
-
"yaml": "2.8.
|
|
37
|
+
"picomatch": "4.0.4",
|
|
38
|
+
"yaml": "2.8.3"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@astrojs/starlight": "0.
|
|
42
|
-
"@types/node": "25.0
|
|
43
|
-
"@types/picomatch": "4.0.
|
|
44
|
-
"astro": "
|
|
45
|
-
"publint": "0.3.
|
|
46
|
-
"tsdown": "0.
|
|
47
|
-
"typescript": "
|
|
41
|
+
"@astrojs/starlight": "0.38.3",
|
|
42
|
+
"@types/node": "25.6.0",
|
|
43
|
+
"@types/picomatch": "4.0.3",
|
|
44
|
+
"astro": "6.1.7",
|
|
45
|
+
"publint": "0.3.18",
|
|
46
|
+
"tsdown": "0.21.9",
|
|
47
|
+
"typescript": "6.0.3"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"astro": ">=5.0.0"
|