Skip to content

Commit 624b9d7

Browse files
authored
Merge pull request #1726 from srmagura/example
The TypeDoc example
2 parents 298de8a + 544e224 commit 624b9d7

25 files changed

+1567
-4
lines changed

.config/.prettierignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
../.nyc_output
22
../coverage
33
../dist
4-
../package-lock.json
4+
**/package-lock.json
55
../src/test/**/specs*.json
66
../src/test/packages/**/*.js
77
../src/test/renderer/specs
8+
../src/test/renderer/testProject
89
../static/main.js
10+
../example/docs/

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
],
1717
"ignorePatterns": [
1818
"src/test/renderer/specs",
19-
"examples",
2019
"dist",
2120
"coverage",
2221
"static/main.js",
2322
"src/lib/output/themes/default/assets",
2423
// Would be nice to lint these, but they shouldn't be included in the project,
2524
// so we need a second eslint config file.
25+
"example",
2626
"src/test/converter",
2727
"src/test/converter2",
2828
"src/test/module",

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ yarn-error.log
99

1010
/src/test/renderer/*/doc
1111
/src/test/renderer/testProject/json.json
12-
/node_modules/
12+
**/node_modules/
1313
/coverage/
1414
/dist/
1515

@@ -21,3 +21,5 @@ src/test/renderer/specs/specs.json
2121

2222
# Built theme JS
2323
static/main.js
24+
25+
/example/docs/

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@
88
},
99
"prettier.enable": true,
1010
"prettier.configPath": ".config/.prettierrc.json",
11-
"prettier.ignorePath": ".config/.prettierignore"
11+
"prettier.ignorePath": ".config/.prettierignore",
12+
"eslint.workingDirectories": [".", "./example"]
1213
}

example/.eslintrc.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../.eslintrc",
3+
"parserOptions": {
4+
"project": "./tsconfig.json"
5+
},
6+
"ignorePatterns": ["docs/"]
7+
}

example/README.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# The TypeDoc Example
2+
3+
Welcome to the TypeDoc example! TypeDoc is a documentation generator for
4+
TypeScript.
5+
6+
TypeDoc automatically documents every variable, function, and class
7+
that is exported by your project. You can add explanations and examples to your
8+
documentation site by annotating your code with doc comments, e.g.
9+
10+
```
11+
/**
12+
* Calculates the square root of a number.
13+
*
14+
* @param x the number to calculate the root of.
15+
* @returns the square root if `x` is non-negative or `NaN` if `x` is negative.
16+
*/
17+
export function sqrt(x: number): number {
18+
return Math.sqrt(x);
19+
}
20+
```
21+
22+
This project shows off some of TypeDoc's features:
23+
24+
- Built-in support for various TypeScript language constructs
25+
- Markdown in doc comments
26+
- Syntax highligting in code blocks
27+
28+
## Index of Examples
29+
30+
**Click the "Exports" link in the sidebar to see a complete list of everything in
31+
the package.**
32+
33+
Here are some examples we wanted to highlight:
34+
35+
### Rendering
36+
37+
- Markdown showcase: [[`markdownShowcase`]]
38+
- Syntax highlighting showcase: [[`syntaxHighlightingShowcase`]]
39+
40+
### Functions
41+
42+
- Simple functions: [[`sqrt`]] and [[`sqrtArrowFunction`]]
43+
- A generic function: [[`concat`]]
44+
- Functions that take an options object: [[`makeHttpCallA`]] and [[`makeHttpCallB`]]
45+
- An overloaded function: [[`overloadedFunction`]]
46+
- An external function exported under a different name: [[`lodashSortBy`]]
47+
48+
### Types
49+
50+
- Type aliases: [[`SimpleTypeAlias`]] and [[`ComplexGenericTypeAlias`]]
51+
- Interfaces: [[`User`]] and [[`AdminUser`]]
52+
53+
### Classes
54+
55+
- A basic class: [[`Customer`]]
56+
- A subclass: [[`DeliveryCustomer`]]
57+
- A complex class: [[`CancellablePromise`]]
58+
- A class that extends a built-in generic type: [[`StringArray`]]
59+
60+
### Enums
61+
62+
- A basic enum: [[`SimpleEnum`]]
63+
- Using the `@enum` tag: [[`EnumLikeObject`]]
64+
65+
### Variables
66+
67+
- [[`PI`]], [[`STRING_CONSTANT`]], and [[`ObjectConstant`]]
68+
69+
### React Components
70+
71+
- Basic React components: [[`CardA`]] and [[`CardB`]]
72+
- A complex React component: [[`EasyFormDialog`]] and [[`EasyFormDialogProps`]]

example/building-the-example.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Building the TypeDoc Example
2+
3+
1. Build TypeDoc: `npm install` and `npm run build` in the root directory.
4+
2. `cd example`
5+
3. `npm install` (the example has its own `package.json`)
6+
4. Typecheck the example: `npm run tsc`
7+
5. Build the docs: `npm run typedoc`

example/media/typescript-logo.svg

Lines changed: 6 additions & 0 deletions
Loading

example/package-lock.json

Lines changed: 237 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)