From 0d88463a66f04034fd7090cbd2f366ac7babe634 Mon Sep 17 00:00:00 2001 From: Matthieu Riegler Date: Mon, 10 Feb 2025 19:44:59 +0100 Subject: [PATCH] docs(docs-infra): inline example in description (#59908) fixes #59905 PR Close #59908 --- .../pipeline/api-gen/extraction/interpolate_code_examples.ts | 1 + .../api-gen/extraction/test/interpolate_code_examples.spec.ts | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/adev/shared-docs/pipeline/api-gen/extraction/interpolate_code_examples.ts b/adev/shared-docs/pipeline/api-gen/extraction/interpolate_code_examples.ts index 91e9ac1df59..094902c1b00 100644 --- a/adev/shared-docs/pipeline/api-gen/extraction/interpolate_code_examples.ts +++ b/adev/shared-docs/pipeline/api-gen/extraction/interpolate_code_examples.ts @@ -43,6 +43,7 @@ const MD_CTYPE_MAP: {[key in FileType]: string} = { export function interpolateCodeExamples(entries: DocEntry[]): void { for (const entry of entries) { entry.rawComment = replaceExample(entry.rawComment); + entry.description = replaceExample(entry.description); for (const jsdocTag of entry.jsdocTags) { jsdocTag.comment = replaceExample(jsdocTag.comment); diff --git a/adev/shared-docs/pipeline/api-gen/extraction/test/interpolate_code_examples.spec.ts b/adev/shared-docs/pipeline/api-gen/extraction/test/interpolate_code_examples.spec.ts index 3cd40b38abc..c0aa3780f16 100644 --- a/adev/shared-docs/pipeline/api-gen/extraction/test/interpolate_code_examples.spec.ts +++ b/adev/shared-docs/pipeline/api-gen/extraction/test/interpolate_code_examples.spec.ts @@ -15,7 +15,7 @@ const tsMdBlock = (code: string) => '```angular-ts\n' + code + '\n```'; const htmlMdBlock = (code: string) => '```angular-html\n' + code + '\n```'; const entriesBuilder = (comment: string): DocEntry[] => [ - {jsdocTags: [], rawComment: comment} as unknown as DocEntry, + {jsdocTags: [], rawComment: comment, description: ''} as unknown as DocEntry, ]; const getComment = (entries: DocEntry[]) => entries[0].rawComment; @@ -35,6 +35,7 @@ describe('interpolate_code_examples', () => { }, ], rawComment: `{@example dummy/jsdocs_raw.ts region='function'}`, + description: `{@example dummy/jsdocs_raw.ts region='function'}`, }, ];