docs(docs-infra): inline example in description (#59908)

fixes #59905

PR Close #59908
This commit is contained in:
Matthieu Riegler
2025-02-10 19:44:59 +01:00
committed by Andrew Scott
parent 4a5c3df824
commit 0d88463a66
2 changed files with 3 additions and 1 deletions
@@ -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);
@@ -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'}`,
},
];