diff --git a/www/generate.ts b/www/generate.ts
index a330df44..91f07bfa 100644
--- a/www/generate.ts
+++ b/www/generate.ts
@@ -261,7 +261,13 @@ function renderClient() {
`
`,
renderAbout(renderComment(module)),
renderFunctions(module),
- renderInterfaces(module),
+ renderInterfaces(module, {
+ filter: (i) => i.name === "Client",
+ depth: "h3",
+ }),
+ renderInterfaces(module, {
+ filter: (i) => i.name !== "Client",
+ }),
`
`,
])
}
@@ -377,12 +383,21 @@ function renderFunctions(module: TypeDoc.DeclarationReflection) {
])
}
-function renderInterfaces(module: TypeDoc.DeclarationReflection) {
+function renderInterfaces(
+ module: TypeDoc.DeclarationReflection,
+ options?: {
+ filter?: (i: TypeDoc.DeclarationReflection) => boolean
+ depth?: "h2" | "h3"
+ },
+) {
console.debug(` ∟renderInterfaces`)
+ const depth = options?.depth ?? "h2"
const interfaces = [
...module.getChildrenByKind(TypeDoc.ReflectionKind.Interface),
...module.getChildrenByKind(TypeDoc.ReflectionKind.TypeAlias),
- ].sort((a, b) => a.name.localeCompare(b.name))
+ ]
+ .filter(options?.filter ?? (() => true))
+ .sort((a, b) => a.name.localeCompare(b.name))
return interfaces.map((i) => {
// render type alias as a type
@@ -407,22 +422,25 @@ function renderInterfaces(module: TypeDoc.DeclarationReflection) {
return [
`## ${i.name}`,
``,
- ``,
- properties.map((p) => [
- `- [${renderProperty(p)}
](#${buildLinkHash(i.name, p.name)}) ${renderType(p.type!)}
`,
- flattenNestedTypes(p.type!, p.name).map(
- ({ depth, prefix, subType }) =>
- `${" ".repeat(depth * 2)}- [${renderProperty(
- subType,
- )}
](#${buildLinkHash(prefix, subType.name)}) ${renderType(subType.type!)}
`,
- ),
+ render(depth === "h2", [
+ ``,
+ properties.map((p) => [
+ `- [${renderProperty(p)}
](#${buildLinkHash(i.name, p.name)}) ${renderType(p.type!)}
`,
+ flattenNestedTypes(p.type!, p.name).map(
+ ({ depth, prefix, subType }) =>
+ `${" ".repeat(depth * 2)}- [${renderProperty(
+ subType,
+ )}
](#${buildLinkHash(prefix, subType.name)}) ${renderType(subType.type!)}
`,
+ ),
+ ]),
+ methods.map((m) => {
+ return `- [${renderProperty(m)}
](#${buildLinkHash(i.name, m.name)}) ${renderSignatureAsType(m.signatures![0])}
`
+ }),
+ ``,
]),
- methods.map((m) => {
- return `- [${renderProperty(m)}
](#${buildLinkHash(i.name, m.name)}) ${renderSignatureAsType(m.signatures![0])}
`
- }),
- ``,
renderComment(i),
``,
+ // Render nested types
properties.flatMap((p) => [
`${renderProperty(p)}`,
``,
@@ -448,7 +466,9 @@ function renderInterfaces(module: TypeDoc.DeclarationReflection) {
),
]),
methods.flatMap((m) => [
- `${renderProperty(m)}`,
+ depth === "h2"
+ ? `${renderProperty(m)}`
+ : `### ${m.name}`,
``,
`