mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 15:15:19 +00:00
docs: generate docs for unversioned schema (#8535)
This commit is contained in:
parent
265db50515
commit
7302bf2f6c
@ -11,7 +11,7 @@ export async function main () {
|
||||
await generateDocs({ configFile, configTemplate })
|
||||
}
|
||||
|
||||
function generateMarkdown (schema: Schema, title: string, level: string, parentVersions: string[] = []) {
|
||||
function generateMarkdown (schema: Schema, title: string, level: string) {
|
||||
const lines: string[] = []
|
||||
|
||||
// Skip private
|
||||
@ -19,16 +19,6 @@ function generateMarkdown (schema: Schema, title: string, level: string, parentV
|
||||
return []
|
||||
}
|
||||
|
||||
// Versions
|
||||
const versions = (schema.tags || []).map(t => t.match(/@version (\d+)/)?.[1]).filter(Boolean)
|
||||
if (!versions.length) {
|
||||
// Inherit from parent if not specified
|
||||
versions.push(...parentVersions)
|
||||
}
|
||||
if (!versions.includes('3')) {
|
||||
return []
|
||||
}
|
||||
|
||||
// Render heading
|
||||
lines.push(`${level} ${title}`, '')
|
||||
|
||||
@ -72,7 +62,7 @@ function generateMarkdown (schema: Schema, title: string, level: string, parentV
|
||||
const keys = Object.keys(schema.properties || {}).sort()
|
||||
for (const key of keys) {
|
||||
const val = schema.properties[key] as Schema
|
||||
const propLines = generateMarkdown(val, `\`${key}\``, level + '#', versions)
|
||||
const propLines = generateMarkdown(val, `\`${key}\``, level + '#')
|
||||
if (propLines.length) {
|
||||
lines.push('', ...propLines)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user