Skip to content

Commit

Permalink
fix: inject docs wherever generate key is located
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Oct 12, 2023
1 parent dafbb69 commit b605738
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions server/plugins/docs-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ export default defineNitroPlugin((nitroApp) => {
file.body = '---\nnavigation: false\n---'
}
// Generate the markdown from the schema
if (file._id === 'nuxt-docs:docs:3.api:6.configuration:nuxt-config.md') {
const GENERATE_KEY = '<!-- GENERATED_CONFIG_DOCS -->'
if (file.body.includes(GENERATE_KEY)) {
const rootSchema = await $fetch<Schema>('https://unpkg.com/@nuxt/schema@latest/schema/config.schema.json')
const GENERATE_KEY = '<!-- GENERATED_CONFIG_DOCS -->'
// Prepare content directory
const start = Date.now()
console.log(`Generating config docs on ${file._id}`)
Expand All @@ -19,10 +19,6 @@ export default defineNitroPlugin((nitroApp) => {
const keys = Object.keys(rootSchema.properties).sort()
let generatedDocs = ''

if (!file.body.includes(GENERATE_KEY)) {
return console.warn(`Could not find ${GENERATE_KEY} in ${file._id}`)
}

// Generate each section
for (const key of keys) {
// @ts-ignore
Expand Down

0 comments on commit b605738

Please sign in to comment.