typedoc-github-theme 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -27,9 +27,13 @@ yarn add typedoc-github-theme
27
27
  **Use the theme when generating your documentation:**
28
28
 
29
29
  ```text
30
- typedoc src/** */ --plugin typedoc-github-theme --theme typedoc-github-theme
30
+ npx typedoc src --plugin typedoc-github-theme
31
31
  ```
32
32
 
33
+ > [!NOTE]
34
+ > This plugin fills the following options if they have not been defined by the user:
35
+ > [`theme`](https://typedoc.org/options/output/#theme), [`lightHighlightTheme`](https://typedoc.org/options/output/#lighthighlighttheme), [`darkHighlightTheme`](https://typedoc.org/options/output/#darkhighlighttheme)
36
+
33
37
  ---
34
38
 
35
39
  ## Author
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GitHubTheme = void 0;
4
+ const fs_1 = require("fs");
5
+ const path_1 = require("path");
6
+ const typedoc_1 = require("typedoc");
7
+ const GitHubThemeContext_1 = require("./GitHubThemeContext");
8
+ class GitHubTheme extends typedoc_1.DefaultTheme {
9
+ initialize() {
10
+ super.initialize();
11
+ // copy the complete assets
12
+ this.application.renderer.on(typedoc_1.RendererEvent.END, () => {
13
+ const from = (0, path_1.resolve)(__dirname, '../src/assets/');
14
+ const to = (0, path_1.resolve)(this.application.options.getValue('out'), 'assets/');
15
+ (0, fs_1.cpSync)(from, to, { recursive: true });
16
+ });
17
+ // link the css file
18
+ this.application.renderer.hooks.on('head.end', (event) => (typedoc_1.JSX.createElement(typedoc_1.JSX.Fragment, null,
19
+ typedoc_1.JSX.createElement("link", { rel: "stylesheet", href: event.relativeURL('assets/typedoc-github-style.css') }))));
20
+ // set the Shiki theme
21
+ this.application.on('bootstrapEnd', () => {
22
+ if (!this.application.options.isSet('lightHighlightTheme')) {
23
+ this.application.options.setValue('lightHighlightTheme', 'github-light-default');
24
+ }
25
+ if (!this.application.options.isSet('darkHighlightTheme')) {
26
+ this.application.options.setValue('darkHighlightTheme', 'github-dark-default');
27
+ }
28
+ });
29
+ }
30
+ getRenderContext(pageEvent) {
31
+ return new GitHubThemeContext_1.GitHubThemeContext(this, pageEvent, this.application.options);
32
+ }
33
+ }
34
+ exports.GitHubTheme = GitHubTheme;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GitHubThemeContext = void 0;
4
+ const typedoc_1 = require("typedoc");
5
+ const footer_1 = require("./partials/footer");
6
+ class GitHubThemeContext extends typedoc_1.DefaultThemeRenderContext {
7
+ footer = () => (0, footer_1.footer)(this);
8
+ }
9
+ exports.GitHubThemeContext = GitHubThemeContext;
package/dist/index.js ADDED
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.load = load;
4
+ const GitHubTheme_1 = require("./GitHubTheme");
5
+ /**
6
+ * Called by TypeDoc when loading this theme as a plugin
7
+ */
8
+ function load(app) {
9
+ app.renderer.defineTheme('typedoc-github-theme', GitHubTheme_1.GitHubTheme);
10
+ app.on('bootstrapEnd', () => {
11
+ if (app.options.isSet('theme') && app.options.getValue('theme') !== 'typedoc-github-theme') {
12
+ return app.logger.warn(`The theme'typedoc-github-theme' is not used because another theme (${app.options.getValue('theme')}) was specified!`);
13
+ }
14
+ app.options.setValue('theme', 'typedoc-github-theme');
15
+ });
16
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.footer = footer;
4
+ const typedoc_1 = require("typedoc");
5
+ function footer(context) {
6
+ return (typedoc_1.JSX.createElement("footer", null,
7
+ context.hook('footer.begin', context),
8
+ generatorDisplay(context),
9
+ customFooterDisplay(context),
10
+ context.hook('footer.end', context)));
11
+ }
12
+ function generatorDisplay(context) {
13
+ if (context.options.getValue('hideGenerator')) {
14
+ return typedoc_1.JSX.createElement(typedoc_1.JSX.Fragment, null);
15
+ }
16
+ return (typedoc_1.JSX.createElement("p", { class: "tsd-generator" },
17
+ 'Generated using ',
18
+ typedoc_1.JSX.createElement("a", { href: "https://typedoc.org/", target: "_blank" }, "TypeDoc"),
19
+ ' with ',
20
+ typedoc_1.JSX.createElement("a", { href: "https://github.com/KillerJulian/typedoc-github-theme", target: "_blank" }, "typedoc-github-theme")));
21
+ }
22
+ function customFooterDisplay(context) {
23
+ const customFooterHtml = context.options.getValue('customFooterHtml');
24
+ if (!customFooterHtml) {
25
+ return typedoc_1.JSX.createElement(typedoc_1.JSX.Fragment, null);
26
+ }
27
+ if (context.options.getValue('customFooterHtmlDisableWrapper')) {
28
+ return typedoc_1.JSX.createElement(typedoc_1.JSX.Raw, { html: customFooterHtml });
29
+ }
30
+ return (typedoc_1.JSX.createElement("p", null,
31
+ typedoc_1.JSX.createElement(typedoc_1.JSX.Raw, { html: customFooterHtml })));
32
+ }
package/package.json CHANGED
@@ -1,31 +1,31 @@
1
1
  {
2
2
  "name": "typedoc-github-theme",
3
3
  "description": "Elegant and seamless look and feel for your TypeScript documentation on GitHub Pages",
4
- "version": "0.1.0",
4
+ "version": "0.1.2",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "repository": "https://github.com/KillerJulian/typedoc-github-theme",
8
8
  "homepage": "https://killerjulian.github.io/typedoc-github-theme/",
9
9
  "author": "KillerJulian <info@killerjulian.de>",
10
10
  "license": "MIT",
11
- "packageManager": "pnpm@9.5.0",
11
+ "packageManager": "pnpm@9.6.0",
12
12
  "dependencies": {},
13
13
  "peerDependencies": {
14
- "typedoc": "^0.26.4"
14
+ "typedoc": "^0.26.0"
15
15
  },
16
16
  "devDependencies": {
17
- "@types/node": "^18.19.41",
18
- "eslint": "9.7.0",
17
+ "@types/node": "^18.19.43",
18
+ "eslint": "9.8.0",
19
19
  "eslint-config-prettier": "9.1.0",
20
20
  "prettier": "3.3.3",
21
- "typedoc": "~0.26.4",
22
- "typescript": "5.5.3",
23
- "typescript-eslint": "8.0.0-alpha.47"
21
+ "typedoc": "~0.26.5",
22
+ "typescript": "5.5.4",
23
+ "typescript-eslint": "8.0.0"
24
24
  },
25
25
  "scripts": {
26
26
  "build": "pnpm build:lib && pnpm build:docs",
27
27
  "build:lib": "tsc",
28
- "build:docs": "typedoc src --plugin ./dist/index.js --theme typedoc-github-theme",
28
+ "build:docs": "typedoc src --plugin ./dist/index.js",
29
29
  "lint": "pnpm lint:format && pnpm lint:code",
30
30
  "lint:code": "eslint .",
31
31
  "lint:format": "prettier --check ."
@@ -0,0 +1,435 @@
1
+ /*
2
+ * Define colors
3
+ */
4
+
5
+ :root {
6
+ /* GitHub "Light default" */
7
+ --light-color-background: #ffffff;
8
+ --light-color-background-secondary: #f6f8fa;
9
+ --light-color-background-navbar: #f6f8fa;
10
+
11
+ --light-color-accent: #d0d7de;
12
+
13
+ --light-color-text: #1f2328;
14
+ --light-color-text-aside: #636c76;
15
+
16
+ --light-color-link: #0969da;
17
+
18
+ --light-color-warning-border: #f7ebba;
19
+ --light-color-background-warning: #fff8c5;
20
+
21
+ /* GitHub "Dark default" */
22
+ --dark-color-background: #0d1117;
23
+ --dark-color-background-secondary: #161b22;
24
+ --dark-color-background-navbar: #000000;
25
+
26
+ --dark-color-accent: #30363d;
27
+
28
+ --dark-color-text: #e6edf3;
29
+ --dark-color-text-aside: #8d96a0;
30
+
31
+ --dark-color-link: #4493f8;
32
+
33
+ --dark-color-warning-border: #3a2d12;
34
+ --dark-color-background-warning: #282215;
35
+
36
+ /* Link colors */
37
+ --color-warning-text: var(--color-text);
38
+ --color-icon-background: var(--color-background);
39
+ --color-focus-outline: var(--color-accent);
40
+ }
41
+
42
+ @media (prefers-color-scheme: light) {
43
+ :root {
44
+ --color-background-navbar: var(--light-color-background-navbar);
45
+ --color-warning-border: var(--light-color-warning-border);
46
+ }
47
+ }
48
+
49
+ @media (prefers-color-scheme: dark) {
50
+ :root {
51
+ --color-background-navbar: var(--dark-color-background-navbar);
52
+ --color-warning-border: var(--dark-color-warning-border);
53
+ }
54
+ }
55
+
56
+ :root[data-theme='light'] {
57
+ --color-background-navbar: var(--light-color-background-navbar);
58
+ --color-warning-border: var(--light-color-warning-border);
59
+ }
60
+
61
+ :root[data-theme='dark'] {
62
+ --color-background-navbar: var(--dark-color-background-navbar);
63
+ --color-warning-border: var(--dark-color-warning-border);
64
+ }
65
+
66
+ /*
67
+ * Define fonts
68
+ */
69
+
70
+ :root {
71
+ --font-family-text: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji',
72
+ 'Segoe UI Emoji';
73
+ --font-family-code: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;
74
+ }
75
+
76
+ body {
77
+ font-family: var(--font-family-text);
78
+ }
79
+
80
+ /*
81
+ * Headlines
82
+ */
83
+
84
+ h1,
85
+ h2,
86
+ h3,
87
+ h4,
88
+ h5,
89
+ h6 {
90
+ margin-top: 1em;
91
+ margin-bottom: 0.5em;
92
+ }
93
+
94
+ /*
95
+ * Links
96
+ */
97
+
98
+ a,
99
+ .tsd-kind-class {
100
+ color: var(--color-link);
101
+ text-decoration: underline;
102
+ }
103
+
104
+ .tsd-index-link {
105
+ text-decoration: none;
106
+ }
107
+
108
+ .tsd-index-link:hover {
109
+ text-decoration: underline;
110
+ }
111
+
112
+ .tsd-sources a {
113
+ color: var(--color-link);
114
+ }
115
+
116
+ /*
117
+ * Lists
118
+ */
119
+
120
+ ul,
121
+ ol {
122
+ margin-left: 20px;
123
+ list-style: disc;
124
+ }
125
+
126
+ li::marker {
127
+ color: var(--color-accent);
128
+ }
129
+
130
+ /*
131
+ * Input fields
132
+ */
133
+
134
+ input {
135
+ background-color: var(--color-background-secondary);
136
+ color: var(--color-text);
137
+ border: 1px solid var(--color-accent);
138
+ border-radius: 6px;
139
+ padding: 8px;
140
+ width: 100%;
141
+ }
142
+
143
+ /*
144
+ * Tables
145
+ */
146
+
147
+ table {
148
+ margin: 1em 0;
149
+ }
150
+
151
+ .tsd-typography th,
152
+ .tsd-typography td {
153
+ padding: 8px;
154
+ text-align: left;
155
+ }
156
+
157
+ .tsd-typography th {
158
+ background-color: var(--color-background);
159
+ color: var(--color-text);
160
+ }
161
+
162
+ .tsd-typography tr:nth-child(2n) {
163
+ background-color: var(--color-background-code);
164
+ }
165
+
166
+ /*
167
+ * Horizontal line
168
+ */
169
+
170
+ .tsd-typography hr {
171
+ color: var(--color-accent);
172
+ }
173
+
174
+ /*
175
+ * Buttons
176
+ */
177
+
178
+ button {
179
+ background-color: var(--color-background-navbar);
180
+ color: var(--color-text);
181
+ border: 1px solid var(--color-accent);
182
+ border-radius: 6px;
183
+ padding: 8px 16px;
184
+ cursor: pointer;
185
+ transition: background-color 0.1s ease-in-out;
186
+ }
187
+
188
+ button:hover {
189
+ background-color: var(--color-accent);
190
+ }
191
+
192
+ pre > button {
193
+ background-color: transparent;
194
+ transition: background-color 0.1s ease-in-out;
195
+ border: none;
196
+ opacity: 1;
197
+ top: 8px;
198
+ padding: 4px 8px;
199
+ }
200
+
201
+ /*
202
+ * Checkbox
203
+ */
204
+
205
+ .tsd-filter-input input[type='checkbox'],
206
+ .tsd-filter-input svg {
207
+ width: 1em;
208
+ height: 1em;
209
+ }
210
+
211
+ .tsd-filter-input svg {
212
+ border-radius: 2px;
213
+ }
214
+
215
+ .tsd-checkbox-background {
216
+ fill: var(--color-background);
217
+ stroke: var(--color-accent);
218
+ stroke-width: 6px;
219
+ }
220
+
221
+ input[type='checkbox']:checked ~ svg .tsd-checkbox-background {
222
+ fill: var(--color-accent);
223
+ }
224
+
225
+ .tsd-checkbox-checkmark {
226
+ color: var(--color-text);
227
+ }
228
+
229
+ /*
230
+ * Select
231
+ */
232
+
233
+ select {
234
+ background-color: var(--color-background);
235
+ border: 1px solid var(--color-accent);
236
+ border-radius: 6px;
237
+ padding: 8px;
238
+ font-family: inherit;
239
+ }
240
+
241
+ /*
242
+ * Code blocks
243
+ */
244
+
245
+ code,
246
+ pre {
247
+ border: none;
248
+ border-radius: 6px;
249
+ margin: 1em 0;
250
+ background-color: var(--color-background-secondary);
251
+ color: var(--color-text);
252
+ font-family: var(--font-family-code);
253
+ }
254
+
255
+ code.tsd-tag {
256
+ background-color: var(--color-accent);
257
+ border: unset;
258
+ }
259
+
260
+ /*
261
+ * Warnings
262
+ */
263
+
264
+ .warning {
265
+ border-style: solid;
266
+ border-width: 1px;
267
+ border-color: var(--color-warning-border);
268
+ border-radius: 6px;
269
+ }
270
+
271
+ /*
272
+ * Topbar
273
+ */
274
+
275
+ .tsd-page-toolbar {
276
+ background-color: var(--color-background-navbar);
277
+ border-bottom-color: var(--color-accent);
278
+ }
279
+
280
+ .tsd-page-toolbar a.title:hover {
281
+ text-decoration: none;
282
+ }
283
+
284
+ #tsd-search.has-focus {
285
+ background-color: var(--color-background-navbar);
286
+ }
287
+
288
+ #tsd-search .results,
289
+ #tsd-search .results li,
290
+ #tsd-search .results li:nth-child(2n) {
291
+ background-color: var(--color-background-navbar);
292
+ }
293
+
294
+ #tsd-search .results li {
295
+ margin-bottom: 0px;
296
+ }
297
+
298
+ #tsd-search .results li:hover:not(.no-results) {
299
+ background-color: var(--color-accent);
300
+ }
301
+
302
+ #tsd-search .results {
303
+ border-style: solid;
304
+ border-width: 1px;
305
+ border-color: var(--color-accent);
306
+ border-radius: 0px 0px 6px 6px;
307
+ overflow: hidden;
308
+ }
309
+
310
+ #tsd-search .results .no-results {
311
+ padding: calc(4px + 0.25rem);
312
+ }
313
+
314
+ /*
315
+ * Baseboard
316
+ */
317
+
318
+ footer {
319
+ border-top-color: var(--color-accent);
320
+ }
321
+
322
+ /*
323
+ * Side navigations
324
+ */
325
+
326
+ .site-menu {
327
+ padding: 1rem 0;
328
+ }
329
+
330
+ .tsd-navigation a {
331
+ color: var(--color-text);
332
+ border-radius: 6px;
333
+ padding: 6px;
334
+ }
335
+
336
+ .tsd-navigation a,
337
+ .tsd-navigation a:hover {
338
+ text-decoration: none;
339
+ }
340
+
341
+ .tsd-navigation a:hover:not(.current) {
342
+ background-color: color-mix(in srgb, var(--color-text-aside), #0000 88%);
343
+ }
344
+
345
+ .tsd-navigation a.current {
346
+ background-color: color-mix(in srgb, var(--color-text-aside), #0000 92%);
347
+ }
348
+
349
+ /*
350
+ * Type definition groups
351
+ */
352
+
353
+ .tsd-index-panel,
354
+ .tsd-member-group {
355
+ background-color: var(--color-background);
356
+ padding: 16px;
357
+ border: 1px var(--color-accent) solid;
358
+ border-radius: 6px;
359
+ }
360
+
361
+ .tsd-panel > h1,
362
+ .tsd-panel > h2,
363
+ .tsd-panel > h3 {
364
+ margin-top: 0px;
365
+ }
366
+
367
+ .tsd-panel-group.tsd-index-group details {
368
+ margin: 0px;
369
+ }
370
+
371
+ .tsd-member-group .tsd-member:last-child {
372
+ margin-bottom: 0px;
373
+ }
374
+
375
+ .tsd-signature {
376
+ border: 1px solid var(--color-accent);
377
+ border-radius: 6px;
378
+ }
379
+
380
+ .tsd-signatures .tsd-signature {
381
+ border-color: var(--color-accent);
382
+ border-radius: 0px;
383
+ }
384
+
385
+ .tsd-description .tsd-signatures .tsd-signature {
386
+ border-radius: 6px;
387
+ }
388
+
389
+ .tsd-full-hierarchy:not(:last-child) {
390
+ border-bottom: var(--color-accent);
391
+ }
392
+
393
+ /*
394
+ * Footer
395
+ */
396
+
397
+ footer p {
398
+ font-size: 1rem;
399
+ text-align: center;
400
+ color: var(--color-text-aside);
401
+ }
402
+
403
+ /*
404
+ * Fix collapsed margin
405
+ */
406
+
407
+ .tsd-accordion-summary.tsd-index-summary > h5 {
408
+ margin-top: 0px;
409
+ margin-bottom: 0px;
410
+ }
411
+
412
+ .tsd-panel-group:not([open]) > .tsd-accordion-summary {
413
+ margin-bottom: 0px;
414
+ }
415
+
416
+ /*
417
+ * Fix collapse arrow position
418
+ */
419
+
420
+ .tsd-accordion-summary:has(svg) > * {
421
+ display: inline-flex;
422
+ align-items: center;
423
+ line-height: normal;
424
+ }
425
+
426
+ .tsd-accordion-summary > * > svg {
427
+ padding-top: 0px;
428
+ position: relative;
429
+ left: 0px;
430
+ top: 50%;
431
+ }
432
+
433
+ .tsd-accordion-summary svg {
434
+ transition: transform 0.1s ease-in-out;
435
+ }