File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change 33export const SCHEMA = {
44 title : 'string' ,
55 description : 'string' ,
6+ path : 'string' ,
67} ;
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import { persistToFile } from '@orama/plugin-data-persistence/server';
55
66import { SCHEMA } from './constants.mjs' ;
77import { groupNodesByModule } from '../../utils/generators.mjs' ;
8+ import { transformNodeToString } from '../../utils/unist.mjs' ;
89
910/**
1011 * Builds a hierarchical title chain based on heading depths
@@ -67,13 +68,16 @@ export default {
6768
6869 // Process all API groups and flatten into a single document array
6970 const documents = Array . from ( apiGroups . values ( ) ) . flatMap ( headings =>
70- headings . map ( ( node , index ) => {
71+ headings . map ( ( entry , index ) => {
7172 const hierarchicalTitle = buildHierarchicalTitle ( headings , index ) ;
73+ const paragraph = entry . content . children . find (
74+ child => child . type === 'paragraph'
75+ ) ;
7276
7377 return {
7478 title : hierarchicalTitle ,
75- // TODO(@avivkeller): Add `description` key.
76- path : `${ node . api } .html#${ node . slug } ` ,
79+ description : paragraph ? transformNodeToString ( paragraph ) : undefined ,
80+ path : `${ entry . api } .html#${ entry . slug } ` ,
7781 } ;
7882 } )
7983 ) ;
You can’t perform that action at this time.
0 commit comments