@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 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-2WLFSQS7.js";
13
+ } from "./chunk-2WML2D77.js";
14
14
  import {
15
15
  buildSectionData
16
- } from "./chunk-QTGT76RY.js";
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-2WLFSQS7.js";
5
+ } from "./chunk-2WML2D77.js";
6
6
  import {
7
7
  scanDocs
8
- } from "./chunk-QTGT76RY.js";
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-XYS5SV4M.js";
11
+ } from "./chunk-GWYMXKDL.js";
12
12
  import {
13
13
  loadUserConfig,
14
14
  resolveConfig,
15
15
  resolveSections
16
- } from "./chunk-2WLFSQS7.js";
16
+ } from "./chunk-2WML2D77.js";
17
17
  import {
18
18
  buildSectionData
19
- } from "./chunk-QTGT76RY.js";
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)
@@ -8,7 +8,7 @@ import {
8
8
  resolveSections,
9
9
  scanHubProjects,
10
10
  writeDataConfig
11
- } from "../chunk-2WLFSQS7.js";
11
+ } from "../chunk-2WML2D77.js";
12
12
  import "../chunk-AJBCHKBP.js";
13
13
  import {
14
14
  defineConfig
@@ -3,7 +3,7 @@ import {
3
3
  buildRoutes,
4
4
  buildSectionData,
5
5
  scanDocs
6
- } from "../chunk-QTGT76RY.js";
6
+ } from "../chunk-CTL4YL7C.js";
7
7
  import "../chunk-5TD7NQIW.js";
8
8
  export {
9
9
  buildNavigation,
@@ -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
 
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  buildSite
3
- } from "../chunk-6YAEHWC7.js";
3
+ } from "../chunk-XR4WG237.js";
4
4
  import "../chunk-PRTER35L.js";
5
5
  import "../chunk-SCZZB7OE.js";
6
- import "../chunk-XYS5SV4M.js";
6
+ import "../chunk-GWYMXKDL.js";
7
7
  import "../chunk-B2Q23JW3.js";
8
- import "../chunk-2WLFSQS7.js";
8
+ import "../chunk-2WML2D77.js";
9
9
  import "../chunk-AJBCHKBP.js";
10
10
  import "../chunk-V7LLYIRO.js";
11
- import "../chunk-QTGT76RY.js";
11
+ import "../chunk-CTL4YL7C.js";
12
12
  import "../chunk-5TD7NQIW.js";
13
13
  export {
14
14
  buildSite
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  checkFrontmatter,
3
3
  checkLinks
4
- } from "../chunk-6XHVO5AO.js";
5
- import "../chunk-2WLFSQS7.js";
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-QTGT76RY.js";
8
+ import "../chunk-CTL4YL7C.js";
9
9
  import "../chunk-5TD7NQIW.js";
10
10
  export {
11
11
  checkFrontmatter,
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  buildSite
3
- } from "../chunk-6YAEHWC7.js";
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-XYS5SV4M.js";
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-6XHVO5AO.js";
18
+ } from "../chunk-HZRIVY25.js";
19
19
  import {
20
20
  loadUserConfig,
21
21
  resolveConfig
22
- } from "../chunk-2WLFSQS7.js";
22
+ } from "../chunk-2WML2D77.js";
23
23
  import "../chunk-AJBCHKBP.js";
24
24
  import "../chunk-V7LLYIRO.js";
25
- import "../chunk-QTGT76RY.js";
25
+ import "../chunk-CTL4YL7C.js";
26
26
  import "../chunk-5TD7NQIW.js";
27
27
 
28
28
  // src/node/index.ts
@@ -61,6 +61,7 @@ interface ClearifyConfig {
61
61
  hubProject?: Omit<HubProject, 'name'>;
62
62
  customCss?: string;
63
63
  headTags?: string[];
64
+ includeReadme?: boolean;
64
65
  }
65
66
  interface NavigationItem {
66
67
  label: string;
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  clearifyPlugin
3
- } from "../chunk-XYS5SV4M.js";
3
+ } from "../chunk-GWYMXKDL.js";
4
4
  import "../chunk-B2Q23JW3.js";
5
- import "../chunk-2WLFSQS7.js";
5
+ import "../chunk-2WML2D77.js";
6
6
  import "../chunk-AJBCHKBP.js";
7
7
  import "../chunk-V7LLYIRO.js";
8
- import "../chunk-QTGT76RY.js";
8
+ import "../chunk-CTL4YL7C.js";
9
9
  import "../chunk-5TD7NQIW.js";
10
10
  export {
11
11
  clearifyPlugin
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marlinjai/clearify",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
4
4
  "description": "An open-source documentation site generator. Turn markdown into beautiful docs.",
5
5
  "type": "module",
6
6
  "bin": {