@valkyrianlabs/payload-markdown 1.4.0 → 1.4.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 +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +3 -2
- package/skills/payload-markdown/claude/SKILL.md +56 -0
- package/skills/payload-markdown/claude/examples/docs-page.md +97 -0
- package/skills/payload-markdown/claude/examples/reference-page.md +75 -0
- package/skills/payload-markdown/claude/examples/release-notes.md +69 -0
- package/skills/payload-markdown/claude/reference/automated-docs-workflow.md +64 -0
- package/skills/payload-markdown/claude/reference/formatting.md +81 -0
- package/skills/payload-markdown/claude/reference/payload-markdown-directives.md +246 -0
- package/skills/payload-markdown/claude/reference/quality.md +48 -0
- package/skills/payload-markdown/claude/scripts/check_payload_markdown_doc.py +155 -0
- package/skills/payload-markdown/codex/SKILL.md +56 -0
- package/skills/payload-markdown/codex/agents/openai.yaml +4 -0
- package/skills/payload-markdown/codex/examples/docs-page.md +97 -0
- package/skills/payload-markdown/codex/examples/reference-page.md +75 -0
- package/skills/payload-markdown/codex/examples/release-notes.md +69 -0
- package/skills/payload-markdown/codex/reference/automated-docs-workflow.md +64 -0
- package/skills/payload-markdown/codex/reference/formatting.md +81 -0
- package/skills/payload-markdown/codex/reference/payload-markdown-directives.md +246 -0
- package/skills/payload-markdown/codex/reference/quality.md +48 -0
- package/skills/payload-markdown/codex/scripts/check_payload_markdown_doc.py +155 -0
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-

|
|
2
2
|
|
|
3
3
|
[](https://github.com/valkyrianlabs/payload-markdown/actions)
|
|
4
4
|
|
package/dist/types.d.ts
CHANGED
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { CollectionSlug, TextField } from 'payload'\n\nimport type {\n MarkdownCodeConfig,\n MarkdownConfig,\n MarkdownDirectiveThemes,\n PayloadMarkdownIconsConfig,\n} from './types/core.js'\n\nexport type DualMarkdownFieldConfig = {\n blocks?: MarkdownConfig\n field?: MarkdownConfig\n}\n\nexport type ConfigOptions = DualMarkdownFieldConfig | MarkdownConfig\n\nexport type MarkdownFieldOptions = {\n admin?: Partial<TextField['admin']>\n defaultValue?: string\n label?: string\n localized?: boolean\n name?: string\n required?: boolean\n}\n\nexport type PayloadMarkdownCollectionConfig = {\n /**\n * Code fence / Shiki rendering options for markdown in this collection.\n */\n code?: MarkdownCodeConfig\n\n /**\n * Styling options for markdown fields added to the collection, and/or markdown fields added within blocks to the collection.\n */\n config?: ConfigOptions\n\n /**\n * Options for the markdown field.\n */\n field?: Omit<MarkdownFieldOptions, 'name'>\n\n /**\n * The name of the markdown field to add to the collection. Defaults to 'content'.\n */\n fieldName?: string\n\n /**\n * Whether to add a standalone markdown field to the collection.\n *\n * If not specified, this is inferred automatically:\n * - `true` when the collection does not contain any `blocks` fields\n * - `false` when the collection does contain `blocks` fields\n */\n installField?: boolean\n\n /**\n * Whether to install the markdown block into any `blocks` fields in the collection.\n *\n * If not specified, this is inferred automatically:\n * - `true` when the collection contains one or more `blocks` fields\n * - `false` when the collection does not contain any `blocks` fields\n *\n * Note: You must still add the MarkdownBlockComponent to your RenderBlocks.tsx\n * or equivalent for the block to render properly.\n */\n installIntoBlocks?: boolean\n\n /**\n * Directive theme registry extensions for markdown in this collection.\n */\n themes?: MarkdownDirectiveThemes\n}\n\nexport interface PayloadMarkdownConfig {\n /**\n * Code fence / Shiki rendering options.\n */\n code?: MarkdownCodeConfig\n\n /**\n * Add markdown field to collections.\n * Set to `true` to add a field with default options, or an object to configure the field.\n */\n collections?: Partial<Record<CollectionSlug, PayloadMarkdownCollectionConfig | true>>\n\n /**\n * Add a global for markdown block settings, which can be used to provide default configuration values for all markdown in the project.\n */\n config?: ConfigOptions\n\n /**\n * Enable or disable plugin\n * @default
|
|
1
|
+
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { CollectionSlug, TextField } from 'payload'\n\nimport type {\n MarkdownCodeConfig,\n MarkdownConfig,\n MarkdownDirectiveThemes,\n PayloadMarkdownIconsConfig,\n} from './types/core.js'\n\nexport type DualMarkdownFieldConfig = {\n blocks?: MarkdownConfig\n field?: MarkdownConfig\n}\n\nexport type ConfigOptions = DualMarkdownFieldConfig | MarkdownConfig\n\nexport type MarkdownFieldOptions = {\n admin?: Partial<TextField['admin']>\n defaultValue?: string\n label?: string\n localized?: boolean\n name?: string\n required?: boolean\n}\n\nexport type PayloadMarkdownCollectionConfig = {\n /**\n * Code fence / Shiki rendering options for markdown in this collection.\n */\n code?: MarkdownCodeConfig\n\n /**\n * Styling options for markdown fields added to the collection, and/or markdown fields added within blocks to the collection.\n */\n config?: ConfigOptions\n\n /**\n * Options for the markdown field.\n */\n field?: Omit<MarkdownFieldOptions, 'name'>\n\n /**\n * The name of the markdown field to add to the collection. Defaults to 'content'.\n */\n fieldName?: string\n\n /**\n * Whether to add a standalone markdown field to the collection.\n *\n * If not specified, this is inferred automatically:\n * - `true` when the collection does not contain any `blocks` fields\n * - `false` when the collection does contain `blocks` fields\n */\n installField?: boolean\n\n /**\n * Whether to install the markdown block into any `blocks` fields in the collection.\n *\n * If not specified, this is inferred automatically:\n * - `true` when the collection contains one or more `blocks` fields\n * - `false` when the collection does not contain any `blocks` fields\n *\n * Note: You must still add the MarkdownBlockComponent to your RenderBlocks.tsx\n * or equivalent for the block to render properly.\n */\n installIntoBlocks?: boolean\n\n /**\n * Directive theme registry extensions for markdown in this collection.\n */\n themes?: MarkdownDirectiveThemes\n}\n\nexport interface PayloadMarkdownConfig {\n /**\n * Code fence / Shiki rendering options.\n */\n code?: MarkdownCodeConfig\n\n /**\n * Add markdown field to collections.\n * Set to `true` to add a field with default options, or an object to configure the field.\n */\n collections?: Partial<Record<CollectionSlug, PayloadMarkdownCollectionConfig | true>>\n\n /**\n * Add a global for markdown block settings, which can be used to provide default configuration values for all markdown in the project.\n */\n config?: ConfigOptions\n\n /**\n * Enable or disable plugin\n * @default true\n */\n enabled?: boolean\n\n /**\n * Local SVG icon pack configuration for markdown directives.\n */\n icons?: PayloadMarkdownIconsConfig\n\n /**\n * Directive theme registry extensions.\n */\n themes?: MarkdownDirectiveThemes\n}\n"],"names":[],"mappings":"AAyEA,WAgCC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@valkyrianlabs/payload-markdown",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "Structured Markdown editing and rendering for Payload CMS with CodeMirror, Shiki, directives, themes, and server-first output.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/valkyrianlabs/payload-markdown"
|
|
@@ -32,7 +32,8 @@
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"files": [
|
|
35
|
-
"dist"
|
|
35
|
+
"dist",
|
|
36
|
+
"skills"
|
|
36
37
|
],
|
|
37
38
|
"scripts": {
|
|
38
39
|
"build": "pnpm copyfiles && pnpm build:types && pnpm build:swc",
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: payload-markdown
|
|
3
|
+
description: Write elegant automated documentation with @valkyrianlabs/payload-markdown. Use when authoring, rewriting, auditing, or structuring docs with Payload Markdown directives, theme names, cards, callouts, steps, tabs, TOCs, buttons, and layout primitives.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Payload Markdown
|
|
7
|
+
|
|
8
|
+
Use this skill to write documentation that renders well with `@valkyrianlabs/payload-markdown`, especially docs generated or maintained by agents for downstream `@valkyrianlabs/payload-markdown-docs` projects.
|
|
9
|
+
|
|
10
|
+
This skill is about authoring clean Markdown content with Payload Markdown directives. It is not a Payload CMS implementation guide.
|
|
11
|
+
|
|
12
|
+
This package stores the Claude variant at `skills/payload-markdown/claude`. When installing into an environment that requires the skill directory name to match `name`, install or copy this subtree as `payload-markdown`.
|
|
13
|
+
|
|
14
|
+
## Workflow
|
|
15
|
+
|
|
16
|
+
1. Inspect the source of truth before writing docs: code, README, existing docs, examples, tests, public API, and current package metadata.
|
|
17
|
+
2. Choose a page shape: overview, installation, reference, migration, troubleshooting, release notes, or API guide.
|
|
18
|
+
3. Use normal Markdown for prose and use directives only where they improve scanning, sequencing, comparison, or calls to action.
|
|
19
|
+
4. Prefer readable directive labels such as `[Install]` over legacy `title=""`.
|
|
20
|
+
5. Keep examples copyable. Use long fences when documenting Markdown that contains code fences.
|
|
21
|
+
6. Run `scripts/check_payload_markdown_doc.py` on changed docs before finishing when local shell access is available.
|
|
22
|
+
|
|
23
|
+
## Reference Map
|
|
24
|
+
|
|
25
|
+
- Read `reference/automated-docs-workflow.md` for source-driven docs generation and audit flow.
|
|
26
|
+
- Read `reference/formatting.md` for frontmatter, headings, links, prose, and fenced examples.
|
|
27
|
+
- Read `reference/payload-markdown-directives.md` for supported directive syntax and recipes.
|
|
28
|
+
- Read `reference/quality.md` before final review or docs drift audits.
|
|
29
|
+
|
|
30
|
+
## Authoring Defaults
|
|
31
|
+
|
|
32
|
+
- Use exactly one H1 per page.
|
|
33
|
+
- Put `:::toc[On this page]{depth="3" theme="compact"}` after the intro on long pages.
|
|
34
|
+
- Use `:::callout` for important notes, warnings, tips, and migration hazards.
|
|
35
|
+
- Use `:::steps` for setup, tutorials, and workflows.
|
|
36
|
+
- Use `:::cards` and `:::card` for page maps, feature groups, related links, and summary grids.
|
|
37
|
+
- Use `:::tabs` only for truly parallel alternatives such as package managers or framework variants.
|
|
38
|
+
- Use `:::details` for optional caveats, migration notes, or advanced branches.
|
|
39
|
+
- Use `:::section`, `:::2col`, `:::3col`, and `:::cell` sparingly for dense landing-style docs sections.
|
|
40
|
+
- Avoid unsupported directives, MDX components, arbitrary HTML widgets, and runtime Tailwind classes in authored Markdown.
|
|
41
|
+
|
|
42
|
+
## Examples
|
|
43
|
+
|
|
44
|
+
- `examples/docs-page.md`: polished docs page with TOC, cards, steps, callouts, tabs, and details.
|
|
45
|
+
- `examples/reference-page.md`: API/reference style page with structured sections and warnings.
|
|
46
|
+
- `examples/release-notes.md`: release note page using cards, details, and migration callouts.
|
|
47
|
+
|
|
48
|
+
## Validation
|
|
49
|
+
|
|
50
|
+
Run the helper on changed Markdown files:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
python3 skills/payload-markdown/claude/scripts/check_payload_markdown_doc.py docs/**/*.md
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
If the downstream project uses `@valkyrianlabs/payload-markdown-docs`, also run its docs validation command when available.
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Installation
|
|
3
|
+
navTitle: Install
|
|
4
|
+
description: Install the package, register the plugin, and render Markdown content.
|
|
5
|
+
order: 20
|
|
6
|
+
status: published
|
|
7
|
+
tags:
|
|
8
|
+
- getting-started
|
|
9
|
+
- installation
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Installation
|
|
13
|
+
|
|
14
|
+
Install the package, enable it for your Payload collections, and render Markdown with the server component.
|
|
15
|
+
|
|
16
|
+
:::toc[On this page]{depth="3" theme="compact"}
|
|
17
|
+
:::
|
|
18
|
+
|
|
19
|
+
:::callout[Before you start]{variant="info"}
|
|
20
|
+
This guide assumes a Payload 3 project with a working Next.js app.
|
|
21
|
+
:::
|
|
22
|
+
|
|
23
|
+
:::steps{
|
|
24
|
+
variant="cards"
|
|
25
|
+
layout="stack"
|
|
26
|
+
numbered
|
|
27
|
+
stepTheme="cyan"
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
### Install The Package
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pnpm add @valkyrianlabs/payload-markdown
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Register The Plugin
|
|
37
|
+
|
|
38
|
+
Add `payloadMarkdown()` to the Payload config and enable the collections that should receive Markdown fields or blocks.
|
|
39
|
+
|
|
40
|
+
### Render Content
|
|
41
|
+
|
|
42
|
+
Use `MarkdownRenderer` for standalone fields and `MarkdownBlockComponent` for `vlMdBlock` entries.
|
|
43
|
+
|
|
44
|
+
:::
|
|
45
|
+
|
|
46
|
+
## Configuration Map
|
|
47
|
+
|
|
48
|
+
:::cards{
|
|
49
|
+
columns="3"
|
|
50
|
+
cardTheme="muted"
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
:::card[Fields And Blocks]{href="/getting-started/fields-and-blocks"}
|
|
54
|
+
Automatic install behavior and manual schema control.
|
|
55
|
+
:::
|
|
56
|
+
|
|
57
|
+
:::card[Rendering]{href="/getting-started/rendering"}
|
|
58
|
+
Server-first Markdown output, scoped config, and fallback behavior.
|
|
59
|
+
:::
|
|
60
|
+
|
|
61
|
+
:::card[Code Blocks]{href="/configuration/code-blocks"}
|
|
62
|
+
Shiki languages, themes, line numbers, and full-bleed code.
|
|
63
|
+
:::
|
|
64
|
+
|
|
65
|
+
:::
|
|
66
|
+
|
|
67
|
+
## Package Manager Alternatives
|
|
68
|
+
|
|
69
|
+
:::tabs{
|
|
70
|
+
default="pnpm"
|
|
71
|
+
theme="glass"
|
|
72
|
+
tabTheme="muted"
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
:::tab[pnpm]{value="pnpm"}
|
|
76
|
+
```bash
|
|
77
|
+
pnpm add @valkyrianlabs/payload-markdown
|
|
78
|
+
```
|
|
79
|
+
:::
|
|
80
|
+
|
|
81
|
+
:::tab[npm]{value="npm"}
|
|
82
|
+
```bash
|
|
83
|
+
npm install @valkyrianlabs/payload-markdown
|
|
84
|
+
```
|
|
85
|
+
:::
|
|
86
|
+
|
|
87
|
+
:::tab[yarn]{value="yarn"}
|
|
88
|
+
```bash
|
|
89
|
+
yarn add @valkyrianlabs/payload-markdown
|
|
90
|
+
```
|
|
91
|
+
:::
|
|
92
|
+
|
|
93
|
+
:::
|
|
94
|
+
|
|
95
|
+
:::details[When to configure icons]
|
|
96
|
+
Configure local SVG icon packs only when authored content uses `icon="@pack/name"` on buttons, cards, or callouts.
|
|
97
|
+
:::
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Renderer API
|
|
3
|
+
navTitle: Renderer
|
|
4
|
+
description: Render Markdown fields and blocks with server-first components.
|
|
5
|
+
order: 80
|
|
6
|
+
status: published
|
|
7
|
+
tags:
|
|
8
|
+
- reference
|
|
9
|
+
- rendering
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Renderer API
|
|
13
|
+
|
|
14
|
+
Use the server renderer for Markdown fields and the block component for `vlMdBlock` layout entries.
|
|
15
|
+
|
|
16
|
+
:::toc[On this page]{depth="3" theme="compact"}
|
|
17
|
+
:::
|
|
18
|
+
|
|
19
|
+
## Exports
|
|
20
|
+
|
|
21
|
+
:::cards{
|
|
22
|
+
columns="2"
|
|
23
|
+
cardTheme="glass"
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
:::card[MarkdownRenderer]
|
|
27
|
+
Server component for Markdown strings stored in fields or loaded from another source.
|
|
28
|
+
:::
|
|
29
|
+
|
|
30
|
+
:::card[MarkdownBlockComponent]
|
|
31
|
+
Server component for Payload block data with `blockType: "vlMdBlock"`.
|
|
32
|
+
:::
|
|
33
|
+
|
|
34
|
+
:::
|
|
35
|
+
|
|
36
|
+
## Field Rendering
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
import { MarkdownRenderer } from '@valkyrianlabs/payload-markdown/server'
|
|
40
|
+
|
|
41
|
+
export function PostBody({ content }: { content?: null | string }) {
|
|
42
|
+
return (
|
|
43
|
+
<MarkdownRenderer
|
|
44
|
+
collectionSlug="posts"
|
|
45
|
+
markdown={content}
|
|
46
|
+
scope="field"
|
|
47
|
+
variant="docs"
|
|
48
|
+
/>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
:::callout[Collection scope]{variant="tip"}
|
|
54
|
+
Pass `collectionSlug` when collection-level `code`, `themes`, or `config` should apply.
|
|
55
|
+
:::
|
|
56
|
+
|
|
57
|
+
## Block Rendering
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
import { MarkdownBlockComponent } from '@valkyrianlabs/payload-markdown/server'
|
|
61
|
+
|
|
62
|
+
export function RenderMarkdownBlock({ block }: { block: { blockType: 'vlMdBlock'; content: string } }) {
|
|
63
|
+
return <MarkdownBlockComponent {...block} collectionSlug="pages" />
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
:::callout[Direct props]{variant="warning"}
|
|
68
|
+
Pass block fields directly with `{...block}`. Do not wrap the data in a `block` prop.
|
|
69
|
+
:::
|
|
70
|
+
|
|
71
|
+
## Fallbacks
|
|
72
|
+
|
|
73
|
+
:::details[Empty and warning fallback behavior]
|
|
74
|
+
`emptyFallback` renders when Markdown is empty or whitespace-only. `errorFallback` renders when compilation produces warnings and you prefer not to show the compiled HTML.
|
|
75
|
+
:::
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Version 1.4.0
|
|
3
|
+
navTitle: v1.4.0
|
|
4
|
+
description: New authoring primitives, icon packs, and directive improvements.
|
|
5
|
+
order: 10
|
|
6
|
+
status: published
|
|
7
|
+
tags:
|
|
8
|
+
- releases
|
|
9
|
+
- changelog
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Version 1.4.0
|
|
13
|
+
|
|
14
|
+
Version 1.4.0 improves directive authoring, local SVG icon usage, and rich docs composition.
|
|
15
|
+
|
|
16
|
+
:::toc[On this page]{depth="3" theme="compact"}
|
|
17
|
+
:::
|
|
18
|
+
|
|
19
|
+
## Highlights
|
|
20
|
+
|
|
21
|
+
:::cards{
|
|
22
|
+
columns="3"
|
|
23
|
+
theme="spacious"
|
|
24
|
+
cardTheme="glass"
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
:::card[Readable Labels]{eyebrow="Authoring"}
|
|
28
|
+
Use `[Title]` directive labels for visible titles instead of dense attribute lists.
|
|
29
|
+
:::
|
|
30
|
+
|
|
31
|
+
:::card[Local Icons]{eyebrow="Rendering"}
|
|
32
|
+
Reference local SVG packs with `@pack/name` on buttons, cards, and callouts.
|
|
33
|
+
:::
|
|
34
|
+
|
|
35
|
+
:::card[Safer Links]{eyebrow="Cards"}
|
|
36
|
+
Use `linkScope="title"` when card bodies contain nested links or buttons.
|
|
37
|
+
:::
|
|
38
|
+
|
|
39
|
+
:::
|
|
40
|
+
|
|
41
|
+
## Migration Notes
|
|
42
|
+
|
|
43
|
+
:::callout[No stored content migration required]{variant="success"}
|
|
44
|
+
Existing `title=""` directive attributes remain supported. New docs should prefer `[Label]`.
|
|
45
|
+
:::
|
|
46
|
+
|
|
47
|
+
:::details[Code config aliases]
|
|
48
|
+
Legacy `config.options` code settings still work, but new docs should use the top-level `code` namespace.
|
|
49
|
+
:::
|
|
50
|
+
|
|
51
|
+
## Upgrade Steps
|
|
52
|
+
|
|
53
|
+
:::steps
|
|
54
|
+
|
|
55
|
+
### Update The Package
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pnpm up @valkyrianlabs/payload-markdown
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Review Custom Themes
|
|
62
|
+
|
|
63
|
+
Confirm theme objects use `classes`, not `className`.
|
|
64
|
+
|
|
65
|
+
### Refresh Examples
|
|
66
|
+
|
|
67
|
+
Prefer labels, multiline attributes, and card link scopes in new docs.
|
|
68
|
+
|
|
69
|
+
:::
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Automated Docs Workflow
|
|
2
|
+
|
|
3
|
+
Use this workflow when generating or maintaining docs with Payload Markdown.
|
|
4
|
+
|
|
5
|
+
## 1. Build The Source Model
|
|
6
|
+
|
|
7
|
+
Before writing, inspect the real project surface:
|
|
8
|
+
|
|
9
|
+
- package metadata and exported entry points
|
|
10
|
+
- README and existing docs
|
|
11
|
+
- public types and config names
|
|
12
|
+
- examples, tests, fixtures, and generated types
|
|
13
|
+
- CLI commands, route names, environment variables, and migration notes
|
|
14
|
+
|
|
15
|
+
Do not describe a feature as implemented unless the source proves it.
|
|
16
|
+
|
|
17
|
+
## 2. Choose The Page Type
|
|
18
|
+
|
|
19
|
+
Use the page type to decide which directives belong:
|
|
20
|
+
|
|
21
|
+
- Overview: cards for page maps, callouts for positioning, short sections.
|
|
22
|
+
- Installation: steps, tabs for package managers, warnings for prerequisites.
|
|
23
|
+
- Usage guide: steps, callouts, details for optional branches.
|
|
24
|
+
- API reference: TOC, dense headings, small cards for related APIs.
|
|
25
|
+
- Migration: danger/warning callouts, steps, details for rollback notes.
|
|
26
|
+
- Troubleshooting: callouts for symptoms, details for error shapes, cards for common causes.
|
|
27
|
+
- Release notes: cards for highlights, details for compatibility notes.
|
|
28
|
+
|
|
29
|
+
## 3. Draft With A Clear Reading Path
|
|
30
|
+
|
|
31
|
+
Write the page in this order:
|
|
32
|
+
|
|
33
|
+
1. H1 with the page topic.
|
|
34
|
+
2. One short paragraph that says what the page helps the reader do.
|
|
35
|
+
3. TOC on long pages.
|
|
36
|
+
4. Main sections ordered from common workflow to advanced detail.
|
|
37
|
+
5. Related links or next steps at the end.
|
|
38
|
+
|
|
39
|
+
Keep prose direct. Avoid marketing copy when the page is operational documentation.
|
|
40
|
+
|
|
41
|
+
## 4. Add Directives For Structure
|
|
42
|
+
|
|
43
|
+
Use directives to make the document easier to scan:
|
|
44
|
+
|
|
45
|
+
- Use callouts for risk, caveats, and important context.
|
|
46
|
+
- Use steps for sequential procedures.
|
|
47
|
+
- Use cards for choice sets, related pages, or capability summaries.
|
|
48
|
+
- Use tabs for equivalent alternatives.
|
|
49
|
+
- Use details for optional information that would interrupt the main path.
|
|
50
|
+
|
|
51
|
+
Do not wrap every paragraph in a directive. The base format is still Markdown.
|
|
52
|
+
|
|
53
|
+
## 5. Audit For Drift
|
|
54
|
+
|
|
55
|
+
During a docs audit, verify:
|
|
56
|
+
|
|
57
|
+
- option names and default values
|
|
58
|
+
- import paths and exported symbols
|
|
59
|
+
- directive names and attributes
|
|
60
|
+
- command names and flags
|
|
61
|
+
- file paths and route paths
|
|
62
|
+
- warnings, limitations, and migration behavior
|
|
63
|
+
|
|
64
|
+
Update docs when they differ from the implementation, even if the drift is small.
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Formatting Guidance
|
|
2
|
+
|
|
3
|
+
## Frontmatter
|
|
4
|
+
|
|
5
|
+
When the docs system supports frontmatter, keep it simple and scalar-first:
|
|
6
|
+
|
|
7
|
+
```yaml
|
|
8
|
+
---
|
|
9
|
+
title: Installation
|
|
10
|
+
navTitle: Install
|
|
11
|
+
description: Install and configure the package.
|
|
12
|
+
order: 20
|
|
13
|
+
status: published
|
|
14
|
+
tags:
|
|
15
|
+
- getting-started
|
|
16
|
+
- installation
|
|
17
|
+
---
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Use only fields that the target docs system supports. Do not invent navigation or publishing fields.
|
|
21
|
+
|
|
22
|
+
## Page Structure
|
|
23
|
+
|
|
24
|
+
- Use exactly one H1.
|
|
25
|
+
- Start with a short summary paragraph.
|
|
26
|
+
- Use H2 for major tasks and H3 for subsections.
|
|
27
|
+
- Avoid skipping heading levels unless the surrounding docs already do.
|
|
28
|
+
- Put the TOC after the intro on long pages.
|
|
29
|
+
|
|
30
|
+
## Links
|
|
31
|
+
|
|
32
|
+
- Use root-relative internal links inside a docs set, such as `/configuration/code-blocks`.
|
|
33
|
+
- Do not link to `.md` source paths unless documenting repository internals.
|
|
34
|
+
- Use external URLs only when the reader must leave the docs set.
|
|
35
|
+
- Prefer descriptive link text over "click here".
|
|
36
|
+
|
|
37
|
+
## Code And Markdown Examples
|
|
38
|
+
|
|
39
|
+
Use language-tagged fences:
|
|
40
|
+
|
|
41
|
+
````md
|
|
42
|
+
```ts
|
|
43
|
+
payloadMarkdown({
|
|
44
|
+
collections: {
|
|
45
|
+
posts: true,
|
|
46
|
+
},
|
|
47
|
+
})
|
|
48
|
+
```
|
|
49
|
+
````
|
|
50
|
+
|
|
51
|
+
When documenting Markdown that contains fenced code blocks, make the outer fence longer than the inner fence:
|
|
52
|
+
|
|
53
|
+
`````md
|
|
54
|
+
````md
|
|
55
|
+
:::steps
|
|
56
|
+
|
|
57
|
+
### Install
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
pnpm add package-name
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
:::
|
|
64
|
+
````
|
|
65
|
+
`````
|
|
66
|
+
|
|
67
|
+
## Prose Style
|
|
68
|
+
|
|
69
|
+
- Prefer direct instructions.
|
|
70
|
+
- Use present tense for current behavior.
|
|
71
|
+
- Use "preferred" or "legacy" instead of implying older syntax is broken when it remains supported.
|
|
72
|
+
- Name defaults explicitly when users depend on them.
|
|
73
|
+
- Keep examples complete enough to copy.
|
|
74
|
+
|
|
75
|
+
## What To Avoid
|
|
76
|
+
|
|
77
|
+
- MDX imports or JSX components unless the target project explicitly supports MDX.
|
|
78
|
+
- Raw HTML widgets for layout.
|
|
79
|
+
- Runtime Tailwind classes in authored Markdown.
|
|
80
|
+
- Unsupported directive names.
|
|
81
|
+
- Placeholder claims such as "fully customizable" without naming the customization surface.
|