@clarify-labs/templates 0.5.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/LICENSE +1 -0
- package/complete/clarify.ts +94 -0
- package/complete/index.html +11 -0
- package/complete/public/favicon.svg +11 -0
- package/complete/public/logo.svg +11 -0
- package/complete/source/en-US/api/embedding.mdx +46 -0
- package/complete/source/en-US/api.openapi.json +319 -0
- package/complete/source/en-US/changelog.mdx +20 -0
- package/complete/source/en-US/guides/navigation.mdx +78 -0
- package/complete/source/en-US/guides/writing-content.mdx +102 -0
- package/complete/source/en-US/index.mdx +77 -0
- package/complete/source/en-US/reference/components.mdx +65 -0
- package/complete/source/en-US/reference/configuration.mdx +76 -0
- package/complete/source/zh-CN/guides/writing-content.mdx +30 -0
- package/complete/source/zh-CN/index.mdx +39 -0
- package/minimal/clarify.ts +9 -0
- package/minimal/index.html +11 -0
- package/minimal/public/favicon.svg +11 -0
- package/minimal/public/logo.svg +11 -0
- package/minimal/source/index.mdx +7 -0
- package/output/index.cjs +87 -0
- package/output/index.cjs.map +1 -0
- package/output/index.d.ts +22 -0
- package/output/index.js +80 -0
- package/output/index.js.map +1 -0
- package/package.json +42 -0
- package/standard/clarify.ts +57 -0
- package/standard/index.html +11 -0
- package/standard/public/favicon.svg +11 -0
- package/standard/public/logo.svg +11 -0
- package/standard/source/changelog.mdx +20 -0
- package/standard/source/guides/navigation.mdx +70 -0
- package/standard/source/guides/writing-content.mdx +102 -0
- package/standard/source/index.mdx +77 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../index.ts"],"sourcesContent":["import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from 'node:fs'\nimport { dirname, relative, resolve } from 'node:path'\n\nexport const supportedTemplates = ['minimal', 'standard', 'complete'] as const\n\nexport type ClarifyTemplate = typeof supportedTemplates[number]\n\nexport type TemplateVariables = {\n contentDir: string\n}\n\nexport type TemplateCopyOptions = {\n contentDir: string\n force?: boolean\n variables?: Partial<TemplateVariables>\n}\n\nexport type TemplateCopyResult = {\n created: string[]\n}\n\nexport class TemplateConflictError extends Error {\n constructor(public readonly conflicts: string[]) {\n super(`[clarify] Init target has conflicting files:\\n${conflicts.map(file => ` - ${file}`).join('\\n')}\\nUse --force to overwrite them.`)\n this.name = 'TemplateConflictError'\n }\n}\n\nexport function resolveTemplate(template?: string): ClarifyTemplate {\n const selectedTemplate = template ?? 'standard'\n if (supportedTemplates.includes(selectedTemplate as ClarifyTemplate)) return selectedTemplate as ClarifyTemplate\n throw new Error(`[clarify] Unknown template \"${selectedTemplate}\". Available templates: ${supportedTemplates.join(', ')}.`)\n}\n\nexport function getTemplateDirectory(templatesDirectory: string, template: ClarifyTemplate): string {\n return resolve(templatesDirectory, template)\n}\n\nexport function renderTemplate(content: string, variables: TemplateVariables): string {\n return content.replaceAll('{{contentDir}}', variables.contentDir)\n}\n\nexport function toTemplateTargetPath(relativePath: string, contentDir: string): string {\n return relativePath.replace(/^source(?=\\/|$)/, contentDir)\n}\n\nexport function copyTemplateDirectory(templateDirectory: string, targetDirectory: string, options: TemplateCopyOptions): TemplateCopyResult {\n const created: string[] = []\n const variables = {\n contentDir: options.contentDir,\n ...options.variables,\n }\n\n if (options.force !== true) {\n const conflicts = findTemplateConflicts(templateDirectory, targetDirectory, options.contentDir)\n if (conflicts.length > 0) throw new TemplateConflictError(conflicts)\n }\n\n copyDirectory(templateDirectory, templateDirectory, targetDirectory, options.contentDir, variables, created)\n\n return { created }\n}\n\nfunction findTemplateConflicts(templateDirectory: string, targetDirectory: string, contentDir: string): string[] {\n const conflicts: string[] = []\n collectTemplateConflicts(templateDirectory, templateDirectory, targetDirectory, contentDir, conflicts)\n return conflicts\n}\n\nfunction collectTemplateConflicts(templateDirectory: string, sourceDirectory: string, targetDirectory: string, contentDir: string, conflicts: string[]): void {\n for (const entry of readdirSync(sourceDirectory, { withFileTypes: true })) {\n const sourcePath = resolve(sourceDirectory, entry.name)\n const sourceRelativePath = relative(templateDirectory, sourcePath)\n const targetRelativePath = toTemplateTargetPath(sourceRelativePath, contentDir)\n const targetPath = resolve(targetDirectory, targetRelativePath)\n\n if (entry.isDirectory()) {\n collectTemplateConflicts(templateDirectory, sourcePath, targetDirectory, contentDir, conflicts)\n continue\n }\n\n if (entry.isFile() && existsSync(targetPath)) conflicts.push(targetRelativePath)\n }\n}\n\nfunction copyDirectory(templateDirectory: string, sourceDirectory: string, targetDirectory: string, contentDir: string, variables: TemplateVariables, created: string[]): void {\n for (const entry of readdirSync(sourceDirectory, { withFileTypes: true })) {\n const sourcePath = resolve(sourceDirectory, entry.name)\n const sourceRelativePath = relative(templateDirectory, sourcePath)\n const targetRelativePath = toTemplateTargetPath(sourceRelativePath, contentDir)\n const targetPath = resolve(targetDirectory, targetRelativePath)\n\n if (entry.isDirectory()) {\n copyDirectory(templateDirectory, sourcePath, targetDirectory, contentDir, variables, created)\n continue\n }\n\n if (!entry.isFile()) continue\n\n const content = renderTemplate(readFileSync(sourcePath, 'utf-8'), variables)\n mkdirSync(dirname(targetPath), { recursive: true })\n writeFileSync(targetPath, content, 'utf-8')\n created.push(targetRelativePath)\n }\n}\n"],"mappings":";;;AAGA,IAAa,qBAAqB;CAAC;CAAW;CAAY;AAAU;AAkBpE,IAAa,wBAAb,cAA2C,MAAM;CACnB;CAA5B,YAAY,WAAqC;EAC/C,MAAM,iDAAiD,UAAU,KAAI,SAAQ,OAAO,MAAM,EAAE,KAAK,IAAI,EAAE,iCAAiC;EAD9G,KAAA,YAAA;EAE1B,KAAK,OAAO;CACd;AACF;AAEA,SAAgB,gBAAgB,UAAoC;CAClE,MAAM,mBAAmB,YAAY;CACrC,IAAI,mBAAmB,SAAS,gBAAmC,GAAG,OAAO;CAC7E,MAAM,IAAI,MAAM,+BAA+B,iBAAiB,0BAA0B,mBAAmB,KAAK,IAAI,EAAE,EAAE;AAC5H;AAEA,SAAgB,qBAAqB,oBAA4B,UAAmC;CAClG,OAAO,QAAQ,oBAAoB,QAAQ;AAC7C;AAEA,SAAgB,eAAe,SAAiB,WAAsC;CACpF,OAAO,QAAQ,WAAW,kBAAkB,UAAU,UAAU;AAClE;AAEA,SAAgB,qBAAqB,cAAsB,YAA4B;CACrF,OAAO,aAAa,QAAQ,mBAAmB,UAAU;AAC3D;AAEA,SAAgB,sBAAsB,mBAA2B,iBAAyB,SAAkD;CAC1I,MAAM,UAAoB,CAAC;CAC3B,MAAM,YAAY;EAChB,YAAY,QAAQ;EACpB,GAAG,QAAQ;CACb;CAEA,IAAI,QAAQ,UAAU,MAAM;EAC1B,MAAM,YAAY,sBAAsB,mBAAmB,iBAAiB,QAAQ,UAAU;EAC9F,IAAI,UAAU,SAAS,GAAG,MAAM,IAAI,sBAAsB,SAAS;CACrE;CAEA,cAAc,mBAAmB,mBAAmB,iBAAiB,QAAQ,YAAY,WAAW,OAAO;CAE3G,OAAO,EAAE,QAAQ;AACnB;AAEA,SAAS,sBAAsB,mBAA2B,iBAAyB,YAA8B;CAC/G,MAAM,YAAsB,CAAC;CAC7B,yBAAyB,mBAAmB,mBAAmB,iBAAiB,YAAY,SAAS;CACrG,OAAO;AACT;AAEA,SAAS,yBAAyB,mBAA2B,iBAAyB,iBAAyB,YAAoB,WAA2B;CAC5J,KAAK,MAAM,SAAS,YAAY,iBAAiB,EAAE,eAAe,KAAK,CAAC,GAAG;EACzE,MAAM,aAAa,QAAQ,iBAAiB,MAAM,IAAI;EAEtD,MAAM,qBAAqB,qBADA,SAAS,mBAAmB,UACP,GAAoB,UAAU;EAC9E,MAAM,aAAa,QAAQ,iBAAiB,kBAAkB;EAE9D,IAAI,MAAM,YAAY,GAAG;GACvB,yBAAyB,mBAAmB,YAAY,iBAAiB,YAAY,SAAS;GAC9F;EACF;EAEA,IAAI,MAAM,OAAO,KAAK,WAAW,UAAU,GAAG,UAAU,KAAK,kBAAkB;CACjF;AACF;AAEA,SAAS,cAAc,mBAA2B,iBAAyB,iBAAyB,YAAoB,WAA8B,SAAyB;CAC7K,KAAK,MAAM,SAAS,YAAY,iBAAiB,EAAE,eAAe,KAAK,CAAC,GAAG;EACzE,MAAM,aAAa,QAAQ,iBAAiB,MAAM,IAAI;EAEtD,MAAM,qBAAqB,qBADA,SAAS,mBAAmB,UACP,GAAoB,UAAU;EAC9E,MAAM,aAAa,QAAQ,iBAAiB,kBAAkB;EAE9D,IAAI,MAAM,YAAY,GAAG;GACvB,cAAc,mBAAmB,YAAY,iBAAiB,YAAY,WAAW,OAAO;GAC5F;EACF;EAEA,IAAI,CAAC,MAAM,OAAO,GAAG;EAErB,MAAM,UAAU,eAAe,aAAa,YAAY,OAAO,GAAG,SAAS;EAC3E,UAAU,QAAQ,UAAU,GAAG,EAAE,WAAW,KAAK,CAAC;EAClD,cAAc,YAAY,SAAS,OAAO;EAC1C,QAAQ,KAAK,kBAAkB;CACjC;AACF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@clarify-labs/templates",
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"license": "AGPL-3.0-only",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/taicode-labs/clarify",
|
|
9
|
+
"directory": "packages/templates"
|
|
10
|
+
},
|
|
11
|
+
"main": "output/index.cjs",
|
|
12
|
+
"module": "output/index.js",
|
|
13
|
+
"types": "output/index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./output/index.d.ts",
|
|
17
|
+
"import": "./output/index.js",
|
|
18
|
+
"require": "./output/index.cjs",
|
|
19
|
+
"default": "./output/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./package.json": "./package.json"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"LICENSE",
|
|
25
|
+
"minimal",
|
|
26
|
+
"standard",
|
|
27
|
+
"complete",
|
|
28
|
+
"output"
|
|
29
|
+
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "vite build",
|
|
32
|
+
"lint": "eslint index.ts",
|
|
33
|
+
"lint:fix": "eslint index.ts --fix",
|
|
34
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/node": "^24.0.0",
|
|
38
|
+
"typescript": "^5.8.3",
|
|
39
|
+
"vite": "^8.0.15",
|
|
40
|
+
"vite-plugin-dts": "^4.5.4"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { defineConfig } from '@clarify-labs/cli'
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
title: 'Clarify Docs',
|
|
5
|
+
description: 'A documentation starter powered by Clarify.',
|
|
6
|
+
logo: '/logo.svg',
|
|
7
|
+
favicon: '/favicon.svg',
|
|
8
|
+
banner: {
|
|
9
|
+
content: 'Edit this starter in {{contentDir}} and ship your docs with Clarify.',
|
|
10
|
+
dismissible: true,
|
|
11
|
+
},
|
|
12
|
+
theme: {
|
|
13
|
+
preset: 'default',
|
|
14
|
+
tokens: {
|
|
15
|
+
colors: {
|
|
16
|
+
primary: '#00D492',
|
|
17
|
+
accent: '#00F6C9',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
navbar: {
|
|
22
|
+
links: [
|
|
23
|
+
{ label: 'Guides', href: '/guides/writing-content' },
|
|
24
|
+
{ label: 'Changelog', href: '/changelog' },
|
|
25
|
+
{ label: 'GitHub', href: 'https://github.com/taicode-labs/clarify', external: true },
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
footer: {
|
|
29
|
+
copyright: '© 2026 Your Company. Built with Clarify.',
|
|
30
|
+
links: [
|
|
31
|
+
{ label: 'Get started', href: '/' },
|
|
32
|
+
{ label: 'Writing content', href: '/guides/writing-content' },
|
|
33
|
+
{ label: 'Changelog', href: '/changelog' },
|
|
34
|
+
],
|
|
35
|
+
socials: {
|
|
36
|
+
GitHub: 'https://github.com/taicode-labs/clarify',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
tabs: [
|
|
40
|
+
{
|
|
41
|
+
tab: 'Docs',
|
|
42
|
+
icon: 'BookOpen',
|
|
43
|
+
pages: [
|
|
44
|
+
{
|
|
45
|
+
group: 'Start here',
|
|
46
|
+
icon: 'Rocket',
|
|
47
|
+
pages: [
|
|
48
|
+
{ page: 'index', title: 'Overview', icon: 'Sparkles' },
|
|
49
|
+
{ page: 'guides/writing-content', title: 'Writing content', icon: 'PenLine' },
|
|
50
|
+
{ page: 'guides/navigation', title: 'Navigation', icon: 'PanelLeft' },
|
|
51
|
+
{ page: 'changelog', title: 'Changelog', icon: 'History' },
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
})
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg width="279px" height="200px" viewBox="0 0 279 200" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
+
<title>clarify</title>
|
|
4
|
+
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
5
|
+
<g id="clarify" transform="translate(-0, 0.0054)">
|
|
6
|
+
<path d="M44.867217,0.0054376148 C130.715579,1.00591567 200,70.9091172 200,156.994562 L199.986321,155.127494 C199.384888,180.009127 179.026368,199.994562 154,199.994562 L46,199.994562 C20.5949015,199.994562 0,179.399661 0,153.994562 L0,45.9945624 C0,21.0975659 19.7793434,0.820282524 44.4815926,0.0191499894 Z" fill="#00D492"></path>
|
|
7
|
+
<path d="M123.867217,0.0054376148 C209.715579,1.00591567 279,70.9091172 279,156.994562 L278.986321,155.127494 C278.384888,180.009127 258.026368,199.994562 233,199.994562 L125,199.994562 C99.5949015,199.994562 79,179.399661 79,153.994562 L79,45.9945624 C79,21.0975659 98.7793434,0.820282524 123.481593,0.0191499894 Z" id="clarify-right" fill-opacity="0.6" fill="#00F6C9" transform="translate(179, 100) rotate(-90) translate(-179, -100)"></path>
|
|
8
|
+
<path d="M199.979267,154.416906 L199.984438,155.157125 L199.962366,155.872459 C198.977251,180.406837 178.776104,199.994562 154,199.994562 L124.372438,199.994125 L124.249053,199.994081 C99.6939678,199.603921 79.8122712,179.973634 79.01915,155.518407 L79.0054376,155.132783 C79.5830823,105.566626 103.129768,61.5221348 139.498462,33.1463428 C175.69419,61.3871018 199.186123,105.143863 199.979267,154.416906 Z" id="形状结合" fill="#00F692"></path>
|
|
9
|
+
</g>
|
|
10
|
+
</g>
|
|
11
|
+
</svg>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg width="279px" height="200px" viewBox="0 0 279 200" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
+
<title>clarify</title>
|
|
4
|
+
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
5
|
+
<g id="clarify" transform="translate(-0, 0.0054)">
|
|
6
|
+
<path d="M44.867217,0.0054376148 C130.715579,1.00591567 200,70.9091172 200,156.994562 L199.986321,155.127494 C199.384888,180.009127 179.026368,199.994562 154,199.994562 L46,199.994562 C20.5949015,199.994562 0,179.399661 0,153.994562 L0,45.9945624 C0,21.0975659 19.7793434,0.820282524 44.4815926,0.0191499894 Z" fill="#00D492"></path>
|
|
7
|
+
<path d="M123.867217,0.0054376148 C209.715579,1.00591567 279,70.9091172 279,156.994562 L278.986321,155.127494 C278.384888,180.009127 258.026368,199.994562 233,199.994562 L125,199.994562 C99.5949015,199.994562 79,179.399661 79,153.994562 L79,45.9945624 C79,21.0975659 98.7793434,0.820282524 123.481593,0.0191499894 Z" id="clarify-right" fill-opacity="0.6" fill="#00F6C9" transform="translate(179, 100) rotate(-90) translate(-179, -100)"></path>
|
|
8
|
+
<path d="M199.979267,154.416906 L199.984438,155.157125 L199.962366,155.872459 C198.977251,180.406837 178.776104,199.994562 154,199.994562 L124.372438,199.994125 L124.249053,199.994081 C99.6939678,199.603921 79.8122712,179.973634 79.01915,155.518407 L79.0054376,155.132783 C79.5830823,105.566626 103.129768,61.5221348 139.498462,33.1463428 C175.69419,61.3871018 199.186123,105.143863 199.979267,154.416906 Z" id="形状结合" fill="#00F692"></path>
|
|
9
|
+
</g>
|
|
10
|
+
</g>
|
|
11
|
+
</svg>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Changelog
|
|
3
|
+
description: Track notable product and documentation changes.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Changelog
|
|
7
|
+
|
|
8
|
+
Use this page to publish notable product, API, and documentation updates.
|
|
9
|
+
|
|
10
|
+
## 2026-06-20
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Initial Clarify documentation starter.
|
|
15
|
+
- Basic MDX authoring examples.
|
|
16
|
+
- OpenAPI reference example.
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- Replace these entries with your real release notes.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Navigation
|
|
3
|
+
description: Configure tabs, sidebar groups, page links, navbar links, and footer links.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Navigation
|
|
7
|
+
|
|
8
|
+
Clarify navigation is configured in `clarify.ts`. The starter uses explicit tabs so users can see how every part fits together.
|
|
9
|
+
|
|
10
|
+
## Tabs and sidebar groups
|
|
11
|
+
|
|
12
|
+
```ts title="clarify.ts"
|
|
13
|
+
export default defineConfig({
|
|
14
|
+
tabs: [
|
|
15
|
+
{
|
|
16
|
+
tab: 'Docs',
|
|
17
|
+
icon: 'BookOpen',
|
|
18
|
+
pages: [
|
|
19
|
+
{
|
|
20
|
+
group: 'Start here',
|
|
21
|
+
icon: 'Rocket',
|
|
22
|
+
pages: [
|
|
23
|
+
{ page: 'index', title: 'Overview', icon: 'Sparkles' },
|
|
24
|
+
{ page: 'guides/writing-content', title: 'Writing content', icon: 'PenLine' },
|
|
25
|
+
{ page: 'changelog', title: 'Changelog', icon: 'History' },
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
})
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## File tree mode
|
|
35
|
+
|
|
36
|
+
For smaller docs, use `FileTree` and let Clarify derive navigation from files.
|
|
37
|
+
|
|
38
|
+
```ts title="clarify.ts"
|
|
39
|
+
export default defineConfig({
|
|
40
|
+
tabs: [
|
|
41
|
+
{
|
|
42
|
+
tab: 'Docs',
|
|
43
|
+
pages: 'FileTree',
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
})
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Navbar and footer
|
|
50
|
+
|
|
51
|
+
```ts title="clarify.ts"
|
|
52
|
+
export default defineConfig({
|
|
53
|
+
navbar: {
|
|
54
|
+
links: [
|
|
55
|
+
{ label: 'Guides', href: '/guides/writing-content' },
|
|
56
|
+
{ label: 'Changelog', href: '/changelog' },
|
|
57
|
+
{ label: 'GitHub', href: 'https://github.com/taicode-labs/clarify', external: true },
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
footer: {
|
|
61
|
+
copyright: '© 2026 Your Company.',
|
|
62
|
+
links: [{ label: 'Changelog', href: '/changelog' }],
|
|
63
|
+
socials: { GitHub: 'https://github.com/taicode-labs/clarify' },
|
|
64
|
+
},
|
|
65
|
+
})
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Next step
|
|
69
|
+
|
|
70
|
+
If your docs need an API reference, initialize the `complete` template or add an OpenAPI file and navigation entry later.
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Writing content
|
|
3
|
+
description: Learn the Clarify MDX patterns included in the starter template.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Writing content
|
|
7
|
+
|
|
8
|
+
Clarify pages are MDX files. You can start with plain Markdown and add components when a page needs richer structure.
|
|
9
|
+
|
|
10
|
+
## Frontmatter
|
|
11
|
+
|
|
12
|
+
Use frontmatter to control page metadata.
|
|
13
|
+
|
|
14
|
+
```mdx title="page.mdx"
|
|
15
|
+
---
|
|
16
|
+
title: Writing content
|
|
17
|
+
description: Explain how authors write documentation.
|
|
18
|
+
keywords:
|
|
19
|
+
- mdx
|
|
20
|
+
- docs
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
# Writing content
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Callouts
|
|
27
|
+
|
|
28
|
+
<Callout title="Use callouts for important notes">
|
|
29
|
+
Callouts are useful for setup requirements, warnings, migration notes, and product constraints.
|
|
30
|
+
</Callout>
|
|
31
|
+
|
|
32
|
+
<Note>
|
|
33
|
+
`Note` is a lightweight MDX primitive for contextual information inside a section.
|
|
34
|
+
</Note>
|
|
35
|
+
|
|
36
|
+
## Cards
|
|
37
|
+
|
|
38
|
+
<CardGroup cols={3}>
|
|
39
|
+
<Card title="Concept" icon="Lightbulb">
|
|
40
|
+
Explain the idea behind a feature.
|
|
41
|
+
</Card>
|
|
42
|
+
<Card title="Guide" icon="Route">
|
|
43
|
+
Walk users through a workflow step by step.
|
|
44
|
+
</Card>
|
|
45
|
+
<Card title="Reference" icon="Library">
|
|
46
|
+
Document exact options, props, commands, or API shapes.
|
|
47
|
+
</Card>
|
|
48
|
+
</CardGroup>
|
|
49
|
+
|
|
50
|
+
## Code groups
|
|
51
|
+
|
|
52
|
+
Use code groups when users need package-manager or framework variants.
|
|
53
|
+
|
|
54
|
+
<CodeGroup title="Install dependencies">
|
|
55
|
+
|
|
56
|
+
```bash title="pnpm"
|
|
57
|
+
pnpm add @clarify-labs/cli
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
```bash title="npm"
|
|
61
|
+
npm install @clarify-labs/cli
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
```bash title="bun"
|
|
65
|
+
bun add @clarify-labs/cli
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
</CodeGroup>
|
|
69
|
+
|
|
70
|
+
## Properties
|
|
71
|
+
|
|
72
|
+
Use properties for configuration, component props, environment variables, or response fields.
|
|
73
|
+
|
|
74
|
+
<Properties>
|
|
75
|
+
<Property name="title" type="string">
|
|
76
|
+
Site title used in the header and SEO metadata.
|
|
77
|
+
</Property>
|
|
78
|
+
<Property name="description" type="string">
|
|
79
|
+
Default description used for pages without a custom description.
|
|
80
|
+
</Property>
|
|
81
|
+
<Property name="tabs" type="ClarifyTabsConfig">
|
|
82
|
+
Top-level navigation areas. Each tab owns its sidebar groups and pages.
|
|
83
|
+
</Property>
|
|
84
|
+
</Properties>
|
|
85
|
+
|
|
86
|
+
## Two-column layout
|
|
87
|
+
|
|
88
|
+
<Row>
|
|
89
|
+
<Col>
|
|
90
|
+
### Explain the workflow
|
|
91
|
+
|
|
92
|
+
Put prose, diagrams, and decisions in the left column. This keeps the guide readable.
|
|
93
|
+
</Col>
|
|
94
|
+
<Col sticky>
|
|
95
|
+
```ts title="example.ts"
|
|
96
|
+
export const docs = {
|
|
97
|
+
format: 'MDX',
|
|
98
|
+
api: 'OpenAPI',
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
</Col>
|
|
102
|
+
</Row>
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Overview
|
|
3
|
+
description: A standard starter showing the common Clarify docs workflow.
|
|
4
|
+
keywords:
|
|
5
|
+
- documentation
|
|
6
|
+
- mdx
|
|
7
|
+
- guides
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Build documentation with Clarify
|
|
11
|
+
|
|
12
|
+
This standard starter includes a practical site configuration, navigation, MDX pages, built-in components, and a changelog. Use it as a clean starting point for product docs, internal docs, or project guides.
|
|
13
|
+
|
|
14
|
+
<Callout title="Starter tip">
|
|
15
|
+
All editable content lives in `{{contentDir}}`. Start with `clarify.ts` for site structure, then edit the MDX pages.
|
|
16
|
+
</Callout>
|
|
17
|
+
|
|
18
|
+
## What is included
|
|
19
|
+
|
|
20
|
+
<CardGroup cols={2}>
|
|
21
|
+
<Card title="Site configuration" icon="Settings2" href="/guides/navigation">
|
|
22
|
+
Navbar links, footer links, banner, theme tokens, tabs, sidebar groups, and Clarify branding.
|
|
23
|
+
</Card>
|
|
24
|
+
<Card title="MDX authoring" icon="PenLine" href="/guides/writing-content">
|
|
25
|
+
Frontmatter, headings, cards, callouts, code groups, properties, and layout primitives.
|
|
26
|
+
</Card>
|
|
27
|
+
<Card title="Navigation guide" icon="PanelLeft" href="/guides/navigation">
|
|
28
|
+
Learn how to edit tabs, sidebar groups, navbar links, and footer links.
|
|
29
|
+
</Card>
|
|
30
|
+
<Card title="Changelog" icon="History" href="/changelog">
|
|
31
|
+
A simple page for documenting notable product and documentation changes.
|
|
32
|
+
</Card>
|
|
33
|
+
</CardGroup>
|
|
34
|
+
|
|
35
|
+
## Quick edits
|
|
36
|
+
|
|
37
|
+
1. Update `clarify.ts` with your product name, theme, navbar, footer, tabs, and sidebar pages.
|
|
38
|
+
2. Replace pages under `{{contentDir}}/guides` with your real documentation.
|
|
39
|
+
3. Update `{{contentDir}}/changelog.mdx` with your release notes.
|
|
40
|
+
4. Run `pnpm dev` to preview and `pnpm build` to create the static site.
|
|
41
|
+
|
|
42
|
+
## Example workflow
|
|
43
|
+
|
|
44
|
+
<Row>
|
|
45
|
+
<Col>
|
|
46
|
+
### Write docs in MDX
|
|
47
|
+
|
|
48
|
+
Use Markdown for normal documentation and MDX components for richer product explanations.
|
|
49
|
+
|
|
50
|
+
<Properties>
|
|
51
|
+
<Property name="Frontmatter" type="YAML">
|
|
52
|
+
Page metadata such as `title`, `description`, and `keywords`.
|
|
53
|
+
</Property>
|
|
54
|
+
<Property name="Navigation" type="clarify.ts">
|
|
55
|
+
Tabs, groups, page links, icons, and top-level links.
|
|
56
|
+
</Property>
|
|
57
|
+
<Property name="Content" type="MDX">
|
|
58
|
+
Pages under `{{contentDir}}` become routes in the generated documentation site.
|
|
59
|
+
</Property>
|
|
60
|
+
</Properties>
|
|
61
|
+
</Col>
|
|
62
|
+
<Col sticky>
|
|
63
|
+
```ts title="clarify.ts"
|
|
64
|
+
import { defineConfig } from '@clarify-labs/cli'
|
|
65
|
+
|
|
66
|
+
export default defineConfig({
|
|
67
|
+
title: 'Your Docs',
|
|
68
|
+
tabs: [
|
|
69
|
+
{
|
|
70
|
+
tab: 'Docs',
|
|
71
|
+
pages: 'FileTree',
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
})
|
|
75
|
+
```
|
|
76
|
+
</Col>
|
|
77
|
+
</Row>
|