Skip to content

Commit

Permalink
docs: separate signature and examples
Browse files Browse the repository at this point in the history
  • Loading branch information
ST-DDT committed Jun 20, 2024
1 parent 909ea01 commit 5a96a0e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/.vitepress/components/api-docs/method.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export interface ApiDocsMethod {
readonly parameters: ApiDocsMethodParameter[];
readonly returns: string;
readonly throws: string | undefined; // HTML
readonly signature: string; // HTML
readonly examples: string; // HTML
readonly seeAlsos: string[];
readonly sourcePath: string; // URL-Suffix
Expand Down
3 changes: 3 additions & 0 deletions docs/.vitepress/components/api-docs/method.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ function seeAlsoToUrl(see: string): string {
<strong>Throws:</strong> <span v-html="props.method.throws" />
</p>

<div v-html="props.method.signature" />

<h3>Examples</h3>
<div v-html="props.method.examples" />

<div v-if="props.method.seeAlsos.length > 0">
Expand Down
3 changes: 2 additions & 1 deletion scripts/apidocs/output/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ async function toMethodData(method: RawApiDocsMethod): Promise<ApiDocsMethod> {
sourcePath: `${filePath}#L${line}`,
throws: throws.length === 0 ? undefined : mdToHtml(throws.join('\n'), true),
returns: returns.text,
examples: codeToHtml([formattedSignature, ...examples].join('\n')),
signature: codeToHtml(formattedSignature),
examples: codeToHtml(examples.join('\n')),
deprecated: mdToHtml(deprecated),
seeAlsos: seeAlsos.map((seeAlso) => mdToHtml(seeAlso, true)),
};
Expand Down

0 comments on commit 5a96a0e

Please sign in to comment.