Browse Source

feat(docs): Alphabetize TS API docs, remove @docsWeight tag

Michael Bromley 6 years ago
parent
commit
b787b72e15
2 changed files with 5 additions and 6 deletions
  1. 0 5
      docs/README.md
  2. 5 1
      scripts/docs/docgen-utils.ts

+ 0 - 5
docs/README.md

@@ -57,10 +57,6 @@ This tag specifies the text description of the declaration. It supports markdown
 
 This tag should be used to include any code blocks. Remember to specify the language after the opening delimiter for correct highlighting. Also applies to class/interface members.
 
-##### `@docsWeight`
-
-This is optional and when present, sets the "weight" of the markdown file in the Hugo front matter. A lower value makes the resulting doc page appear higher in the menu. If not specified, a default value of `10` is used.
-
 ##### `@default`
 
 This is used to specify the default value of a property, e.g. when documenting an optional configuration option.
@@ -87,7 +83,6 @@ class.
  * ```
  *
  * @docsCategory helpers
- * @docsWeight 1
  */
 export class Greeter {
 

+ 5 - 1
scripts/docs/docgen-utils.ts

@@ -8,7 +8,7 @@ import { basename } from 'path';
  */
 export function generateFrontMatter(title: string, weight: number, showToc: boolean = true): string {
     return `---
-title: "${title.replace(/-/g, ' ')}"
+title: "${titleCase(title.replace(/-/g, ' '))}"
 weight: ${weight}
 date: ${new Date().toISOString()}
 showtoc: ${showToc}
@@ -18,6 +18,10 @@ generated: true
 `;
 }
 
+export function titleCase(input: string): string {
+    return input.split(' ').map(w => w[0].toLocaleUpperCase() + w.substr(1)).join(' ');
+}
+
 /**
  * Delete all generated docs found in the outputPath.
  */