@marlinjai/clearify 1.12.0 → 1.13.0
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 +1 -0
- package/dist/node/{chunk-2WLFSQS7.js → chunk-2WML2D77.js} +2 -1
- package/dist/node/{chunk-QTGT76RY.js → chunk-CTL4YL7C.js} +21 -0
- package/dist/node/{chunk-XYS5SV4M.js → chunk-GWYMXKDL.js} +7 -5
- package/dist/node/{chunk-6XHVO5AO.js → chunk-HZRIVY25.js} +2 -2
- package/dist/node/{chunk-6YAEHWC7.js → chunk-XR4WG237.js} +5 -4
- package/dist/node/core/config.js +1 -1
- package/dist/node/core/navigation.js +1 -1
- package/dist/node/core/search.d.ts +1 -0
- package/dist/node/node/build.js +4 -4
- package/dist/node/node/check.js +3 -3
- package/dist/node/node/index.js +5 -5
- package/dist/node/types/index.d.ts +1 -0
- package/dist/node/vite-plugin/index.js +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,6 +14,7 @@ An open-source documentation site generator. Turn markdown into beautiful docs.
|
|
|
14
14
|
- **OpenAPI API Reference** — custom-built renderer for OpenAPI specs with code examples, schema viewer, and full design system integration
|
|
15
15
|
- **Multi-section support** — pill-based section switcher (e.g. public docs + internal docs)
|
|
16
16
|
- **Auto changelog** — drop a `CHANGELOG.md` in your project root, it appears as `/changelog`
|
|
17
|
+
- **README as landing page** — optionally include your project's `README.md` as the docs overview page
|
|
17
18
|
|
|
18
19
|
## Quick Start
|
|
19
20
|
|
|
@@ -100,7 +100,8 @@ var ClearifyConfigSchema = z.object({
|
|
|
100
100
|
hub: HubConfigSchema,
|
|
101
101
|
hubProject: HubProjectPartialSchema,
|
|
102
102
|
customCss: z.string().optional(),
|
|
103
|
-
headTags: z.array(z.string()).optional()
|
|
103
|
+
headTags: z.array(z.string()).optional(),
|
|
104
|
+
includeReadme: z.boolean().default(false)
|
|
104
105
|
});
|
|
105
106
|
var ClearifyDataSchema = z.object({
|
|
106
107
|
name: z.string().optional(),
|
|
@@ -133,9 +133,30 @@ function buildRoutes(docs, sectionId) {
|
|
|
133
133
|
...sectionId ? { sectionId } : {}
|
|
134
134
|
}));
|
|
135
135
|
}
|
|
136
|
+
function extractReadmeTitle(content) {
|
|
137
|
+
const match = content.match(/^#\s+(.+)$/m);
|
|
138
|
+
return match ? match[1].trim() : "Overview";
|
|
139
|
+
}
|
|
136
140
|
function buildSectionData(section, rootFiles, customNavigation) {
|
|
137
141
|
const docs = scanDocs(section.docsDir, section.exclude, section.basePath);
|
|
138
142
|
if (section.basePath === "/") {
|
|
143
|
+
if (rootFiles?.readmePath && existsSync(rootFiles.readmePath)) {
|
|
144
|
+
const hasIndex = docs.some((d) => d.routePath === "/");
|
|
145
|
+
if (!hasIndex) {
|
|
146
|
+
const content = readFileSync(rootFiles.readmePath, "utf-8");
|
|
147
|
+
const { data } = matter(content);
|
|
148
|
+
const title = extractReadmeTitle(content);
|
|
149
|
+
docs.unshift({
|
|
150
|
+
filePath: rootFiles.readmePath,
|
|
151
|
+
routePath: "/",
|
|
152
|
+
frontmatter: {
|
|
153
|
+
title: data.title ?? title,
|
|
154
|
+
description: data.description ?? "Project overview",
|
|
155
|
+
order: -1
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
}
|
|
139
160
|
if (rootFiles?.changelogPath && existsSync(rootFiles.changelogPath)) {
|
|
140
161
|
const content = readFileSync(rootFiles.changelogPath, "utf-8");
|
|
141
162
|
const { data } = matter(content);
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
resolveSections,
|
|
11
11
|
scanHubProjects,
|
|
12
12
|
writeDataConfig
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-2WML2D77.js";
|
|
14
14
|
import {
|
|
15
15
|
buildSectionData
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-CTL4YL7C.js";
|
|
17
17
|
|
|
18
18
|
// src/vite-plugin/index.ts
|
|
19
19
|
import { resolve, dirname } from "path";
|
|
@@ -59,7 +59,8 @@ function clearifyPlugin(options = {}) {
|
|
|
59
59
|
function getRootFiles() {
|
|
60
60
|
return {
|
|
61
61
|
changelogPath: resolve(userRoot, "CHANGELOG.md"),
|
|
62
|
-
roadmapPath: resolve(userRoot, "ROADMAP.md")
|
|
62
|
+
roadmapPath: resolve(userRoot, "ROADMAP.md"),
|
|
63
|
+
...config.includeReadme ? { readmePath: resolve(userRoot, "README.md") } : {}
|
|
63
64
|
};
|
|
64
65
|
}
|
|
65
66
|
async function refreshDocs() {
|
|
@@ -285,7 +286,7 @@ ${routeEntries.join(",\n")}
|
|
|
285
286
|
server.watcher.add(section.docsDir);
|
|
286
287
|
}
|
|
287
288
|
const rootFiles = getRootFiles();
|
|
288
|
-
for (const rootFile of [rootFiles.changelogPath, rootFiles.roadmapPath]) {
|
|
289
|
+
for (const rootFile of [rootFiles.changelogPath, rootFiles.roadmapPath, rootFiles.readmePath]) {
|
|
289
290
|
if (rootFile && existsSync(rootFile)) {
|
|
290
291
|
server.watcher.add(rootFile);
|
|
291
292
|
}
|
|
@@ -407,8 +408,9 @@ ${routeEntries.join(",\n")}
|
|
|
407
408
|
server.watcher.on("all", (event, path) => {
|
|
408
409
|
const isChangelog = path === rootFiles.changelogPath;
|
|
409
410
|
const isRoadmap = path === rootFiles.roadmapPath;
|
|
411
|
+
const isReadme = path === rootFiles.readmePath;
|
|
410
412
|
const isInSection = visibleSections.some((s) => path.startsWith(s.docsDir));
|
|
411
|
-
if (!isChangelog && !isRoadmap && !isInSection) return;
|
|
413
|
+
if (!isChangelog && !isRoadmap && !isReadme && !isInSection) return;
|
|
412
414
|
if (!path.endsWith(".md") && !path.endsWith(".mdx")) return;
|
|
413
415
|
if (event === "add" || event === "unlink" || event === "change") {
|
|
414
416
|
refreshDocs().then(() => {
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
loadUserConfig,
|
|
3
3
|
resolveConfig,
|
|
4
4
|
resolveSections
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-2WML2D77.js";
|
|
6
6
|
import {
|
|
7
7
|
scanDocs
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-CTL4YL7C.js";
|
|
9
9
|
|
|
10
10
|
// src/node/check.ts
|
|
11
11
|
import { resolve, relative } from "path";
|
|
@@ -8,15 +8,15 @@ import {
|
|
|
8
8
|
} from "./chunk-SCZZB7OE.js";
|
|
9
9
|
import {
|
|
10
10
|
clearifyPlugin
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-GWYMXKDL.js";
|
|
12
12
|
import {
|
|
13
13
|
loadUserConfig,
|
|
14
14
|
resolveConfig,
|
|
15
15
|
resolveSections
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-2WML2D77.js";
|
|
17
17
|
import {
|
|
18
18
|
buildSectionData
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-CTL4YL7C.js";
|
|
20
20
|
|
|
21
21
|
// src/node/build.ts
|
|
22
22
|
import { build as viteBuild } from "vite";
|
|
@@ -157,7 +157,8 @@ async function buildSite() {
|
|
|
157
157
|
const productionSections = allSections.filter((s) => !s.draft);
|
|
158
158
|
const rootFiles = {
|
|
159
159
|
changelogPath: resolve(userRoot, "CHANGELOG.md"),
|
|
160
|
-
roadmapPath: resolve(userRoot, "ROADMAP.md")
|
|
160
|
+
roadmapPath: resolve(userRoot, "ROADMAP.md"),
|
|
161
|
+
...config.includeReadme ? { readmePath: resolve(userRoot, "README.md") } : {}
|
|
161
162
|
};
|
|
162
163
|
const sectionDataList = productionSections.map(
|
|
163
164
|
(section) => buildSectionData(section, rootFiles, config.navigation)
|
package/dist/node/core/config.js
CHANGED
|
@@ -29,6 +29,7 @@ interface SectionData {
|
|
|
29
29
|
interface RootFileOptions {
|
|
30
30
|
changelogPath?: string;
|
|
31
31
|
roadmapPath?: string;
|
|
32
|
+
readmePath?: string;
|
|
32
33
|
}
|
|
33
34
|
declare function buildSectionData(section: ResolvedSection, rootFiles?: RootFileOptions, customNavigation?: NavigationItem[] | null): SectionData;
|
|
34
35
|
|
package/dist/node/node/build.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildSite
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-XR4WG237.js";
|
|
4
4
|
import "../chunk-PRTER35L.js";
|
|
5
5
|
import "../chunk-SCZZB7OE.js";
|
|
6
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-GWYMXKDL.js";
|
|
7
7
|
import "../chunk-B2Q23JW3.js";
|
|
8
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-2WML2D77.js";
|
|
9
9
|
import "../chunk-AJBCHKBP.js";
|
|
10
10
|
import "../chunk-V7LLYIRO.js";
|
|
11
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-CTL4YL7C.js";
|
|
12
12
|
import "../chunk-5TD7NQIW.js";
|
|
13
13
|
export {
|
|
14
14
|
buildSite
|
package/dist/node/node/check.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
checkFrontmatter,
|
|
3
3
|
checkLinks
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-HZRIVY25.js";
|
|
5
|
+
import "../chunk-2WML2D77.js";
|
|
6
6
|
import "../chunk-AJBCHKBP.js";
|
|
7
7
|
import "../chunk-V7LLYIRO.js";
|
|
8
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-CTL4YL7C.js";
|
|
9
9
|
import "../chunk-5TD7NQIW.js";
|
|
10
10
|
export {
|
|
11
11
|
checkFrontmatter,
|
package/dist/node/node/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildSite
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-XR4WG237.js";
|
|
4
4
|
import {
|
|
5
5
|
remarkMermaidToComponent
|
|
6
6
|
} from "../chunk-PRTER35L.js";
|
|
7
7
|
import "../chunk-SCZZB7OE.js";
|
|
8
8
|
import {
|
|
9
9
|
clearifyPlugin
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-GWYMXKDL.js";
|
|
11
11
|
import "../chunk-B2Q23JW3.js";
|
|
12
12
|
import {
|
|
13
13
|
init
|
|
@@ -15,14 +15,14 @@ import {
|
|
|
15
15
|
import {
|
|
16
16
|
checkFrontmatter,
|
|
17
17
|
checkLinks
|
|
18
|
-
} from "../chunk-
|
|
18
|
+
} from "../chunk-HZRIVY25.js";
|
|
19
19
|
import {
|
|
20
20
|
loadUserConfig,
|
|
21
21
|
resolveConfig
|
|
22
|
-
} from "../chunk-
|
|
22
|
+
} from "../chunk-2WML2D77.js";
|
|
23
23
|
import "../chunk-AJBCHKBP.js";
|
|
24
24
|
import "../chunk-V7LLYIRO.js";
|
|
25
|
-
import "../chunk-
|
|
25
|
+
import "../chunk-CTL4YL7C.js";
|
|
26
26
|
import "../chunk-5TD7NQIW.js";
|
|
27
27
|
|
|
28
28
|
// src/node/index.ts
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
clearifyPlugin
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-GWYMXKDL.js";
|
|
4
4
|
import "../chunk-B2Q23JW3.js";
|
|
5
|
-
import "../chunk-
|
|
5
|
+
import "../chunk-2WML2D77.js";
|
|
6
6
|
import "../chunk-AJBCHKBP.js";
|
|
7
7
|
import "../chunk-V7LLYIRO.js";
|
|
8
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-CTL4YL7C.js";
|
|
9
9
|
import "../chunk-5TD7NQIW.js";
|
|
10
10
|
export {
|
|
11
11
|
clearifyPlugin
|