fix(website): always link in TypeAlias (#10105)

* fix(website): always link in TypeAlias

* fix: use div instead span for DocParagraph
This commit is contained in:
Qjuh
2024-02-04 01:39:00 +01:00
committed by GitHub
parent 56943a72f4
commit bc9b487eb1
4 changed files with 21 additions and 25 deletions

View File

@@ -1690,20 +1690,22 @@ export class ApiModelGenerator {
}
private _fixLinkTags(input?: string): string | undefined {
return input?.replaceAll(linkRegEx, (_match, _p1, _p2, _p3, _p4, _p5, _offset, _string, groups) => {
let target = groups.class ?? groups.url;
const external = this._jsDocJson?.externals.find((external) => groups.class && external.name === groups.class);
const match = /discord-api-types-(?<type>[^#]*?)(?:#|\/(?<kind>[^#/]*)\/)(?<name>[^/}]*)}$/.exec(
external?.see?.[0] ?? '',
);
if (match) {
target = `discord-api-types#(${match.groups!.name}:${
/^v\d+$/.test(match.groups!.type!) ? match.groups!.kind : 'type'
})`;
}
return input
?.replaceAll(linkRegEx, (_match, _p1, _p2, _p3, _p4, _p5, _offset, _string, groups) => {
let target = groups.class ?? groups.url;
const external = this._jsDocJson?.externals.find((external) => groups.class && external.name === groups.class);
const match = /discord-api-types-(?<type>[^#]*?)(?:#|\/(?<kind>[^#/]*)\/)(?<name>[^/}]*)}$/.exec(
external?.see?.[0] ?? '',
);
if (match) {
target = `discord-api-types#(${match.groups!.name}:${
/^v\d+$/.test(match.groups!.type!) ? match.groups!.kind : 'type'
})`;
}
return `{@link ${target}${groups.prop ? `.${groups.prop}` : ''}${groups.name ? ` |${groups.name}` : ''}}`;
});
return `{@link ${target}${groups.prop ? `.${groups.prop}` : ''}${groups.name ? ` |${groups.name}` : ''}}`;
})
.replaceAll('* ', '\n * * ');
}
private _mapVarType(typey: DocgenVarTypeJson): IExcerptToken[] {