@valkyrianlabs/payload-markdown-docs 0.5.3 → 0.6.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
@@ -73,6 +73,10 @@ to a matching docs set from the configured branch.
73
73
 
74
74
  ## Render In Next
75
75
 
76
+ The plugin does not mutate your Pages collection and does not register public
77
+ frontend routes. Add route handlers in your Next app where you want docs to
78
+ render.
79
+
76
80
  ```tsx
77
81
  import config from '@payload-config'
78
82
  import {
@@ -108,6 +112,37 @@ const docsLinks = await getPayloadMarkdownDocsLinks({ payload })
108
112
  // [{ label: 'Payload Markdown Docs', url: '/plugins/payload-markdown-docs' }]
109
113
  ```
110
114
 
115
+ ## Serve Raw Markdown
116
+
117
+ The AI-facing raw Markdown export is a route-handler response, not a generated
118
+ Payload Page. Add a `route.ts` at the exported path, usually the value from
119
+ `docs/index.ai.yml`:
120
+
121
+ ```ts
122
+ // app/(frontend)/plugins/payload-markdown-docs.md/route.ts
123
+ import config from '@payload-config'
124
+ import { createPayloadMarkdownDocsMarkdownResponse } from '@valkyrianlabs/payload-markdown-docs/next'
125
+ import { notFound } from 'next/navigation'
126
+ import { getPayload } from 'payload'
127
+
128
+ export async function GET() {
129
+ const payload = await getPayload({ config })
130
+ const response = await createPayloadMarkdownDocsMarkdownResponse({
131
+ payload,
132
+ path: '/plugins/payload-markdown-docs.md',
133
+ })
134
+
135
+ if (response) {
136
+ return response
137
+ }
138
+
139
+ notFound()
140
+ }
141
+ ```
142
+
143
+ The response is `text/markdown; charset=utf-8` and is assembled from synced
144
+ docs records using `docs/index.ai.yml` when present.
145
+
111
146
  ## Validate Locally
112
147
 
113
148
  In an app or docs repository that has installed this package:
@@ -127,6 +162,19 @@ pnpm cli validate ./docs --source payload-markdown-docs
127
162
  In GitHub Actions, `--source` can be omitted when the docs set slug matches the
128
163
  repository name. The CLI infers it from `GITHUB_REPOSITORY`.
129
164
 
165
+ ## Maintain Docs With Codex
166
+
167
+ In a docs set target application, install the local Codex skill so agents have
168
+ repo-local guidance for maintaining Markdown docs, frontmatter, `index.ai.yml`,
169
+ validation, and sync safety rules.
170
+
171
+ ```bash
172
+ pnpm exec payload-markdown-docs install skill --codex
173
+ ```
174
+
175
+ The installer writes `.agents/skills/payload-markdown-docs/`. It does not sync
176
+ docs, call Payload, or publish content.
177
+
130
178
  ## Publish From GitHub Actions
131
179
 
132
180
  ```yaml
@@ -1,3 +1,7 @@
1
+ ---
2
+ name: payload-markdown-docs
3
+ description: Use this skill when maintaining Git-backed documentation for a project that uses `@valkyrianlabs/payload-markdown-docs`.
4
+
1
5
  # Payload Markdown Docs Skill
2
6
 
3
7
  Use this skill when maintaining Git-backed documentation for a project that uses `@valkyrianlabs/payload-markdown-docs`.
@@ -11,8 +15,10 @@ The docs source lives in `{{docsRoot}}` unless the user says otherwise. Edit Mar
11
15
  - Use supported frontmatter only.
12
16
  - Keep internal docs links root-relative inside the docs set, such as `/getting-started/quick-start`.
13
17
  - Use `payload-markdown` directives only when they are supported.
18
+ - Keep formatting plain Markdown: supported frontmatter, one H1, clear H2/H3 sections, root-relative links, and supported directives.
14
19
  - Do not invent directives, frontmatter fields, CLI flags, sync modes, or runtime features.
15
20
  - Do not describe unsupported features as implemented.
21
+ - Do not add MDX, arbitrary YAML objects, inline frontmatter arrays, HTML widgets, or one Payload Page per Markdown file.
16
22
  - Run validation before finishing docs edits.
17
23
  - Treat sync and publishing as CMS/server-owned. The request may ask; Payload
18
24
  docs sets and plugin config decide.
@@ -39,6 +45,7 @@ Rules for `index.ai.yml`:
39
45
  - Do not show the manifest in human docs navigation.
40
46
  - Do not render the manifest as a normal docs page.
41
47
  - Use it as the canonical ordering source for the `.md` export.
48
+ - Remember that the `.md` export is served by a Next route handler, not by a generated Payload Page.
42
49
  - Avoid backend hand-sorting unless the project already has a docs sort field.
43
50
 
44
51
  Ordering source preference:
@@ -154,6 +161,7 @@ Sync writes require `sync.allowWrites: true`. Publishing additionally requires `
154
161
  ## References
155
162
 
156
163
  - `reference/payload-markdown-directives.md`
164
+ - `reference/formatting.md`
157
165
  - `reference/frontmatter.md`
158
166
  - `reference/workflow.md`
159
167
  - `reference/sync.md`
@@ -0,0 +1,24 @@
1
+ # Formatting
2
+
3
+ Keep docs as plain Markdown that validates before sync.
4
+
5
+ Expected shape:
6
+
7
+ - supported frontmatter at the top
8
+ - one H1 for the page title
9
+ - H2 and H3 sections for structure
10
+ - root-relative internal links, such as `/workflow/publishing`
11
+ - supported `payload-markdown` directives only
12
+ - `index.ai.yml` updated when pages are added, moved, renamed, or removed
13
+
14
+ Do not add:
15
+
16
+ - `.mdx` files
17
+ - arbitrary YAML objects
18
+ - inline frontmatter arrays
19
+ - invented directive names or props
20
+ - HTML scripts, iframes, or client-side widgets
21
+ - one Payload Page per Markdown file
22
+ - production docs domains for internal links
23
+
24
+ Prefer short, concrete sections over long pages with deeply nested headings.
@@ -35,5 +35,7 @@ Rules:
35
35
  - `tags` and `redirectFrom` must use list item syntax.
36
36
  - `slug` may contain letters, numbers, and hyphens.
37
37
  - Avoid arbitrary nested YAML objects.
38
+ - Avoid inline arrays such as `tags: [getting-started]`.
38
39
  - Avoid unsupported fields unless the user accepts validation warnings.
39
40
  - Explicit `title` is preferred even though title fallback exists.
41
+ - Use `slug` only to override the final route segment; move files to change route hierarchy.
@@ -34,3 +34,11 @@ Do not hardcode production docs domains for internal navigation.
34
34
  ## Route Adapter
35
35
 
36
36
  The `/next` export can resolve docs routes and let an app fall back to normal Pages rendering when no docs route matches. It does not mutate Pages.
37
+
38
+ ## Raw Markdown
39
+
40
+ The AI-facing `.md` export is served by a Next route handler. It is not a
41
+ generated Payload Page and cannot be returned from a `page.tsx` catch-all.
42
+
43
+ Use `createPayloadMarkdownDocsMarkdownResponse` at the output path from
44
+ `index.ai.yml`, or place AI exports in a dedicated namespace such as `/ai`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valkyrianlabs/payload-markdown-docs",
3
- "version": "0.5.3",
3
+ "version": "0.6.0",
4
4
  "description": "Git-backed Markdown documentation sync for Payload CMS, powered by payload-markdown.",
5
5
  "bin": {
6
6
  "payload-markdown-docs": "./dist/cli/index.js"