Skip to content

Commit 9b66567

Browse files
committed
docs: Update documentation
1 parent a2392aa commit 9b66567

File tree

7 files changed

+129
-11
lines changed

7 files changed

+129
-11
lines changed

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,21 @@ Again, update entrypoints to match your file and package layout. See [TypeDoc's
6666

6767
You are now able to use the TypeScript handler to inject API docs in your Markdown pages by referencing package names:
6868

69-
```python
69+
```md
7070
::: @owner/packageName
7171
handler: typescript
7272
```
73+
74+
You can set the Typescript handler as default handler:
75+
76+
```yaml
77+
plugins:
78+
- mkdocstrings:
79+
default_handler: typescript
80+
```
81+
82+
By setting it as default handler you can omit it when injecting documentation:
83+
84+
```md
85+
::: @owner/packageName
86+
```

docs/css/material.css

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,25 @@
22
.md-main__inner {
33
margin-bottom: 1.5rem;
44
}
5+
6+
/* Custom admonition: preview */
7+
:root {
8+
--md-admonition-icon--preview: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.5 12a3.5 3.5 0 1 1-7 0 3.5 3.5 0 0 1 7 0Z"/><path d="M12 3.5c3.432 0 6.124 1.534 8.054 3.241 1.926 1.703 3.132 3.61 3.616 4.46a1.6 1.6 0 0 1 0 1.598c-.484.85-1.69 2.757-3.616 4.461-1.929 1.706-4.622 3.24-8.054 3.24-3.432 0-6.124-1.534-8.054-3.24C2.02 15.558.814 13.65.33 12.8a1.6 1.6 0 0 1 0-1.598c.484-.85 1.69-2.757 3.616-4.462C5.875 5.034 8.568 3.5 12 3.5ZM1.633 11.945a.115.115 0 0 0-.017.055c.001.02.006.039.017.056.441.774 1.551 2.527 3.307 4.08C6.691 17.685 9.045 19 12 19c2.955 0 5.31-1.315 7.06-2.864 1.756-1.553 2.866-3.306 3.307-4.08a.111.111 0 0 0 .017-.056.111.111 0 0 0-.017-.056c-.441-.773-1.551-2.527-3.307-4.08C17.309 6.315 14.955 5 12 5 9.045 5 6.69 6.314 4.94 7.865c-1.756 1.552-2.866 3.306-3.307 4.08Z"/></svg>');
9+
}
10+
11+
.md-typeset .admonition.preview,
12+
.md-typeset details.preview {
13+
border-color: rgb(220, 139, 240);
14+
}
15+
16+
.md-typeset .preview>.admonition-title,
17+
.md-typeset .preview>summary {
18+
background-color: rgba(142, 43, 155, 0.1);
19+
}
20+
21+
.md-typeset .preview>.admonition-title::before,
22+
.md-typeset .preview>summary::before {
23+
background-color: rgb(220, 139, 240);
24+
-webkit-mask-image: var(--md-admonition-icon--preview);
25+
mask-image: var(--md-admonition-icon--preview);
26+
}

docs/usage/configuration/general.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Local `extra` options will be merged into the global `extra` option:
1212
```yaml title="in mkdocs.yml (global configuration)"
1313
plugins:
1414
- mkdocstrings:
15+
default_handler: typescript
1516
handlers:
1617
typescript:
1718
options:
@@ -20,10 +21,10 @@ plugins:
2021
```
2122
2223
```md title="in docs/some_page.md (local configuration)"
23-
::: your_package.your_module.your_func
24+
::: @owner/packageName
2425
options:
2526
extra:
2627
foo: bar
2728
```
2829
29-
...will inject both `hello` and `foo` into the Jinja context when rendering `your_package.your_module.your_func`.
30+
...will inject both `hello` and `foo` into the Jinja context when rendering `@owner/packageName`.

docs/usage/configuration/headings.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ A custom string to use as the heading of the root object (i.e. the object specif
1010
WARNING: **Not advised to be used as a global configuration option.** This option is not advised to be used as a global configuration option, as it will override the default heading for all objects. It is recommended to use it only in specific cases where you want to override the heading for a specific object.
1111

1212
```md title="in docs/some_page.md (local configuration)"
13-
::: path.to.module
13+
::: @owner/package
1414
options:
1515
heading: "My fancy module"
1616
```
@@ -32,14 +32,15 @@ If you set it to 3, then headings will start with `<h3>`.
3232
```yaml title="in mkdocs.yml (global configuration)"
3333
plugins:
3434
- mkdocstrings:
35+
default_handler: typescript
3536
handlers:
3637
typescript:
3738
options:
3839
heading_level: 2
3940
```
4041
4142
```md title="or in docs/some_page.md (local configuration)"
42-
::: path.to.module
43+
::: @owner/package
4344
options:
4445
heading_level: 3
4546
```
@@ -102,14 +103,15 @@ To customize symbols, see [Customizing symbol types](../customization.md/#symbol
102103
```yaml title="in mkdocs.yml (global configuration)"
103104
plugins:
104105
- mkdocstrings:
106+
default_handler: typescript
105107
handlers:
106108
typescript:
107109
options:
108110
show_symbol_type_heading: true
109111
```
110112

111113
```md title="or in docs/some_page.md (local configuration)"
112-
::: package.module
114+
::: @owner/package
113115
options:
114116
show_symbol_type_heading: false
115117
```
@@ -190,14 +192,15 @@ To customize symbols, see [Customizing symbol types](../customization.md/#symbol
190192
```yaml title="in mkdocs.yml (global configuration)"
191193
plugins:
192194
- mkdocstrings:
195+
default_handler: typescript
193196
handlers:
194197
typescript:
195198
options:
196199
show_symbol_type_toc: true
197200
```
198201

199202
```md title="or in docs/some_page.md (local configuration)"
200-
::: package.module
203+
::: @owner/package
201204
options:
202205
show_symbol_type_toc: false
203206
```
@@ -262,8 +265,8 @@ WARNING: **Not advised to be used as a global configuration option.** This optio
262265
NOTE: **Use with/without `heading`.** If you use this option without specifying a custom `heading`, the default heading will be used in the page, but the label in the Table of Contents will be the one you specified. By providing both an option for `heading` and `toc_label`, we leave the customization entirely up to you.
263266

264267
```md title="in docs/some_page.md (local configuration)"
265-
::: path.to.module
268+
::: @owner/package
266269
options:
267-
heading: "My fancy module"
268-
toc_label: "My fancy module"
270+
heading: "My fancy package"
271+
toc_label: "My fancy package"
269272
```

docs/usage/configuration/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ For example, globally:
1010
plugins:
1111
- mkdocstrings:
1212
handlers:
13-
python:
13+
typescript:
1414
options:
1515
do_something: true
1616
```

docs/usage/index.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Usage
2+
3+
Add these [TypeDoc](https://typedoc.org/) configuration files to your repository:
4+
5+
```tree hl_lines="4 5"
6+
./
7+
src/
8+
package1/
9+
typedoc.base.json
10+
typedoc.json
11+
```
12+
13+
```json title="typedoc.base.json"
14+
{
15+
"$schema": "https://typedoc.org/schema.json",
16+
"includeVersion": true
17+
}
18+
```
19+
20+
```json title="typedoc.json"
21+
{
22+
"extends": ["./typedoc.base.json"],
23+
"entryPointStrategy": "packages",
24+
"entryPoints": ["./src/*"]
25+
}
26+
```
27+
28+
Update the entrypoints to match your file layout so that TypeDoc can find your packages. See [TypeDoc's configuration documentation](https://typedoc.org/options/configuration/).
29+
30+
Then in each of your package, add this TypeDoc configuration file:
31+
32+
```tree hl_lines="4"
33+
./
34+
src/
35+
package1/
36+
typedoc.json
37+
typedoc.base.json
38+
typedoc.json
39+
```
40+
41+
```json title="typedoc.json"
42+
{
43+
"extends": ["../../typedoc.base.json"],
44+
"entryPointStrategy": "expand",
45+
"entryPoints": ["src/index.d.ts"]
46+
}
47+
```
48+
49+
Again, update entrypoints to match your file and package layout. See [TypeDoc's configuration documentation](https://typedoc.org/options/configuration/).
50+
51+
**Your packages must be built for TypeDoc to work.**
52+
53+
You are now able to use the TypeScript handler to inject API docs in your Markdown pages by referencing package names:
54+
55+
```md
56+
::: @owner/packageName
57+
handler: typescript
58+
```
59+
60+
You can set the Typescript handler as default handler:
61+
62+
```yaml
63+
plugins:
64+
- mkdocstrings:
65+
default_handler: typescript
66+
```
67+
68+
By setting it as default handler you can omit it when injecting documentation:
69+
70+
```md
71+
::: @owner/packageName
72+
```

mkdocs.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@ markdown_extensions:
9393
- admonition
9494
- callouts
9595
- footnotes
96+
- pymdownx.blocks.admonition
97+
- pymdownx.blocks.tab:
98+
alternate_style: true
99+
slugify: !!python/object/apply:pymdownx.slugs.slugify
100+
kwds:
101+
case: lower
96102
- pymdownx.emoji:
97103
emoji_index: !!python/name:material.extensions.emoji.twemoji
98104
emoji_generator: !!python/name:material.extensions.emoji.to_svg

0 commit comments

Comments
 (0)