Files
FixIt/packages/gen-docs/src/renderers/config.ts
T
Cell 2c0b48370b feat(gen-docs): add Hugo partials docs generation (#809)
* feat(gen-docs): add documentation generation package with SassDoc and TypeDoc support

Add new `@hugo-fixit/gen-docs` package that parses Hugo config (hugo.toml) and generates
documentation. Includes SassDoc annotations for SCSS variables and mixins, TypeDoc config
for TypeScript source docs, and a `.sassdocrc` configuration file.

* docs(readme): add browsers support section

* feat(gen-docs): add Hugo partials docs generation and fix config empty sections

- Add partial-parser.ts: parses Hugo partial comment blocks (@param/@return/@example)
- Add partials.ts renderer: generates grouped Markdown with param tables
- Add `partials` subcommand with -t/-o options for template injection
- Fix config-parser: empty TOML sections (library.js/library.css) now retain descriptions
- Fix config-parser: correctly distinguish section-level vs key-level comments
- Update README with partials subcommand documentation
2026-07-21 12:19:07 +08:00

43 lines
1.1 KiB
TypeScript

function now(): string {
const d = new Date()
const pad = (n: number) => String(n).padStart(2, '0')
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}T00:00:00+08:00`
}
export function renderConfig(body: string): string {
const lines: string[] = []
lines.push('---')
lines.push('title: Configuration Reference')
lines.push('shortTitle: Configuration')
lines.push(`date: ${now()}`)
lines.push('description: Hugo configuration reference for the FixIt Hugo theme.')
lines.push('collections:')
lines.push(' - References')
lines.push('---')
lines.push('')
lines.push('This page is auto-generated from `hugo.toml`. Do not edit manually.')
lines.push('')
lines.push('<!--more-->')
lines.push('')
lines.push(body)
return lines.join('\n')
}
/**
* Render standalone config docs with frontmatter (for CLI -o output).
*/
export function renderConfigStandalone(body: string): string {
const lines: string[] = []
lines.push('---')
lines.push('title: FixIt Theme Configuration')
lines.push(`date: ${now()}`)
lines.push('---')
lines.push('')
lines.push(body)
return lines.join('\n')
}