README: add theatre logo. Add/fix social links (#113)

* add theatre logo. Add/fix social links

* remove styles that don't work in github md

* Add more detailed getting started links to README

* change github links to use theatre-js org and autoformat
This commit is contained in:
Elliot 2022-04-05 13:29:40 -04:00 committed by GitHub
parent f1a1f48c0f
commit 0cc4f795a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 203 additions and 91 deletions

View file

@ -1,6 +1,9 @@
# Writing API docs
We use [API extractor](https://api-extractor.com/pages/setup/generating_docs/) to generate API docs in markdown. We put the markdown files in the [theatre-docs](https://github.com/ariaminaei/theatre-docs/) repo, which also contains the tutorials and guides.
We use [API extractor](https://api-extractor.com/pages/setup/generating_docs/)
to generate API docs in markdown. We put the markdown files in the
[theatre-docs](https://github.com/theatre-js/theatre-docs/) repo, which also
contains the tutorials and guides.
To generate the API docs, run the `build:api-docs` from the root of the repo:
@ -10,16 +13,20 @@ $ yarn build:api-docs /path/to/theatre-docs/docs/api/ # this will empty the /api
## JSDoc/TSDoc gotchas
We are using TSDoc for documentation generation, IDEs use JSDoc for tooltips. TSDoc and JSDoc have subtle differences. We need to optimize for both.
We are using TSDoc for documentation generation, IDEs use JSDoc for tooltips.
TSDoc and JSDoc have subtle differences. We need to optimize for both.
Most users will read our documentation inside their IDEs.
Most users will read our documentation inside their IDEs.
### `@example`
IDEs automatically wrap example sections in `` ``` `` if they aren't already wrapped by you. This means you can't use non-code explanations in example sections, like TSDoc examples do.
IDEs automatically wrap example sections in ` ``` ` if they aren't already
wrapped by you. This means you can't use non-code explanations in example
sections, like TSDoc examples do.
This will be formatted incorrectly:
```ts
````ts
/**
* Adds two numbers together.
* @example
@ -35,42 +42,54 @@ This will be formatted incorrectly:
* console.log(add(1,-1));
* ```
*/
export function add(x: number, y: number): number {
}
```
export function add(x: number, y: number): number {}
````
Some IDEs have problems with having multiple example sections in the same JSDoc comment.
Some IDEs have problems with having multiple example sections in the same JSDoc
comment.
WebStorm doesnt highlight examples if you wrap them in `` ``` ``.
WebStorm doesnt highlight examples if you wrap them in ` ``` `.
api-documenter doesnt highlight examples if you don't wrap them in `` ``` ``.
api-documenter doesnt highlight examples if you don't wrap them in ` ``` `.
### Guidelines
- Only use one `@example` section
- Use a single code block in it, no explanations
- Wrap the code block in `` ```ts ... ``` `` (the `ts` modifier is important, api-documenter copies the `@example` section verbatim, and our documentation page might not highlight the vanilla `` ``` `` sections)
- Wrap the code block in ` ```ts ... ``` ` (the `ts` modifier is important,
api-documenter copies the `@example` section verbatim, and our documentation
page might not highlight the vanilla ` ``` ` sections)
- If you need to explain the code, use code comments
#### `@typeParam`
api-documenter doesnt generate documentation for it, but IDEs might display it even if they don't have bespoke support for it.
api-documenter doesnt generate documentation for it, but IDEs might display it
even if they don't have bespoke support for it.
#### `@link`
While in JSDoc you can specify paths relative to the current declaration, TSDoc requires everything to be specified relative to the entry point. That is, if `bar` is a member of `Foo`, and `Foo` is exported in the entry, you need to refer to `bar` as `Foo.bar`, even inside `Foo`.
While in JSDoc you can specify paths relative to the current declaration, TSDoc
requires everything to be specified relative to the entry point. That is, if
`bar` is a member of `Foo`, and `Foo` is exported in the entry, you need to
refer to `bar` as `Foo.bar`, even inside `Foo`.
JSDoc allows separating the link text from the link either with a space or using `|`. TSDoc only supports `|`, *and* you mustnt have spaces around it. So for example `{@link MyClass | go here}` would be rendered incorrectly, whereas `{@link MyClass|go here}` would be correct.
JSDoc allows separating the link text from the link either with a space or using
`|`. TSDoc only supports `|`, _and_ you mustnt have spaces around it. So for
example `{@link MyClass | go here}` would be rendered incorrectly, whereas
`{@link MyClass|go here}` would be correct.
#### `@param`
api-documenter wont render the documentation for object properties, but document them anyway, IDEs do.
api-documenter wont render the documentation for object properties, but
document them anyway, IDEs do.
Since documentation is only rendered for the object and not for its properties, make sure to include examples for these properties.
Since documentation is only rendered for the object and not for its properties,
make sure to include examples for these properties.
#### `@see`
While JSDoc attempts to hyperlink to anything after the `@see` tag, TSDoc requires an explicit `{@link}` tag tag to make hyperlinks.
While JSDoc attempts to hyperlink to anything after the `@see` tag, TSDoc
requires an explicit `{@link}` tag tag to make hyperlinks.
**Incorrect ❌**
@ -83,7 +102,7 @@ While JSDoc attempts to hyperlink to anything after the `@see` tag, TSDoc requir
* @param url - the string to be parsed
* @returns the parsed result
*/
function parseURL(url: string): ParsedUrl;
function parseURL(url: string): ParsedUrl
```
**Correct ✅**
@ -97,5 +116,5 @@ function parseURL(url: string): ParsedUrl;
* @param url - The string to be parsed
* @returns The parsed result
*/
function parseURL(url: string): ParsedUrl;
```
function parseURL(url: string): ParsedUrl
```