mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
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:
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user