feat(docs-infra): remove redundant JSDoc transform related to code examples (#59004)

The transform is no longer relevant nor it served any functional purpose.

PR Close #59004
This commit is contained in:
hawkgs 2024-11-29 15:27:37 +02:00 committed by Pawel Kozlowski
parent 8eb20463bf
commit 7e4d312aed

View file

@ -101,9 +101,7 @@ export function addHtmlUsageNotes<T extends HasJsDocTags>(entry: T): T & HasHtml
({name}) => name === JS_DOC_USAGE_NOTES_TAG || name === JS_DOC_REMARKS_TAG,
);
const htmlUsageNotes = usageNotesTag
? (marked.parse(
convertJsDocExampleToHtmlExample(wrapExampleHtmlElementsWithCode(usageNotesTag.comment)),
) as string)
? (marked.parse(wrapExampleHtmlElementsWithCode(usageNotesTag.comment)) as string)
: '';
const transformedHtml = addApiLinksToHtml(htmlUsageNotes);
@ -178,17 +176,6 @@ function wrapExampleHtmlElementsWithCode(text: string) {
.replace(/'<img>'/g, `<code><img></code>`);
}
function convertJsDocExampleToHtmlExample(text: string): string {
const codeExampleAtRule = /{@example (\S+) region=(['"])([^'"]+)\2\s*}/g;
return text.replace(
codeExampleAtRule,
(_: string, path: string, separator: string, region: string) => {
return `<code-example path="${path}" region="${region}" />`;
},
);
}
/**
* Converts {@link } tags into html anchor elements
*/