docs(llms): handle prose props in llms-full.txt (#4111)

This commit is contained in:
Hugo Richard
2025-05-10 19:52:01 +02:00
committed by GitHub
parent 37eabc89bd
commit 983c6382d1

View File

@@ -351,6 +351,7 @@ export default defineNitroPlugin((nitroApp) => {
visitAndReplace(doc, 'component-props', (node) => { visitAndReplace(doc, 'component-props', (node) => {
const attributes = node[1] as Record<string, string> const attributes = node[1] as Record<string, string>
const mdcSpecificName = attributes?.name const mdcSpecificName = attributes?.name
const isProse = parseBoolean(attributes[':prose'])
const finalComponentName = mdcSpecificName ? camelCase(mdcSpecificName) : componentName const finalComponentName = mdcSpecificName ? camelCase(mdcSpecificName) : componentName
@@ -358,11 +359,13 @@ export default defineNitroPlugin((nitroApp) => {
if (!componentMeta?.props) return if (!componentMeta?.props) return
const interfaceName = isProse ? `Prose${pascalCaseName}Props` : `${pascalCaseName}Props`
const interfaceCode = generateTSInterface( const interfaceCode = generateTSInterface(
`${pascalCaseName}Props`, interfaceName,
Object.values(componentMeta.props), Object.values(componentMeta.props),
propItemHandler, propItemHandler,
`Props for the ${pascalCaseName} component` `Props for the ${isProse ? 'Prose' : ''}${pascalCaseName} component`
) )
replaceNodeWithPre(node, 'ts', interfaceCode) replaceNodeWithPre(node, 'ts', interfaceCode)
}) })