diff --git a/src/scripts/parser/apidoc/c-apidoc-parser.ts b/src/scripts/parser/apidoc/c-apidoc-parser.ts index f585ac7..d321916 100644 --- a/src/scripts/parser/apidoc/c-apidoc-parser.ts +++ b/src/scripts/parser/apidoc/c-apidoc-parser.ts @@ -124,6 +124,24 @@ export class CApiDocParser { } } + // Parses a Doxygen description structure into Markdown-formatted string. + private parseDescriptionSection(description: any): string { + let md = ""; + const items = ensureArray(description); + console.log(JSON.stringify(items, null, 2)); + + for (const item of items) { + // Handle plain text or detailedDescription + if (typeof item === "string") { + md += this.escapeMarkdown(item) + "\n\n"; + } else if (item["#text"]) { + md += this.escapeMarkdown(this.extractText(item["#text"])) + "\n\n"; + } + } + + return md.trim(); + } + private parseDocFile(compound: any): DocFile { const functions: FunctionDoc[] = []; const typedefs: TypeDefDoc[] = []; @@ -136,8 +154,9 @@ export class CApiDocParser { const parsedFile = this.xmlParser.parse(file); const compounddef = parsedFile?.doxygen?.compounddef; const compoundName = compounddef?.compoundname; - const briefDescription = compounddef?.briefdescription || ""; - const detailedDescription = compounddef?.detaileddescription?.para || ""; + const briefDescription = compounddef?.briefdescription?.para || ""; + const detailedDescription = this.parseDescriptionSection(compounddef?.detaileddescription?.para || []); + const location = compounddef?.location?.["@_file"] || ""; const sectionDefs = ensureArray(compounddef?.sectiondef); for (const sectionDef of sectionDefs) {