-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcustom-typedoc-plugin.js
65 lines (48 loc) · 2.16 KB
/
custom-typedoc-plugin.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/* eslint-disable import/no-unused-modules */
// @ts-check
import { MarkdownTheme, MarkdownThemeContext } from 'typedoc-plugin-markdown';
/**
* @param {import('typedoc-plugin-markdown').MarkdownApplication} app
*/
export function load(app) {
app.renderer.defineTheme('custom-markdown-theme', MyMarkdownTheme);
app.renderer.markdownHooks.on(
'content.begin',
() => `> Last updated ${new Date().toISOString()}`
);
const footerText = `***
**Contributing**
Want to contribute? Please read the [CONTRIBUTING.md](https://github.com/phun-ky/speccer/blob/main/CONTRIBUTING.md) and [CODE_OF_CONDUCT.md](https://github.com/phun-ky/speccer/blob/main/CODE_OF_CONDUCT.md)
**Sponsor me**
I'm an Open Source evangelist, creating stuff that does not exist yet to help get rid of secondary activities and to enhance systems already in place, be it documentation or web sites.
The sponsorship is an unique opportunity to alleviate more hours for me to maintain my projects, create new ones and contribute to the large community we're all part of :)
[Support me on GitHub Sponsors](https://github.com/sponsors/phun-ky).

***
This project created by [Alexander Vassbotn Røyne-Helgesen](http://phun-ky.net) is licensed under a [MIT License](https://choosealicense.com/licenses/mit/).
`;
app.renderer.markdownHooks.on(
'page.end',
() => footerText
);
app.renderer.markdownHooks.on(
'index.page.end',
() => footerText
);
}
class MyMarkdownTheme extends MarkdownTheme {
/**
* @param {import('typedoc-plugin-markdown').MarkdownPageEvent} page
*/
getRenderContext(page) {
return new MyMarkdownThemeContext(this, page, this.application.options);
}
}
class MyMarkdownThemeContext extends MarkdownThemeContext {
partials = {
...this.partials,
header: () => {
return '<div><img alt="SPECCER logo" src="https://raw.githubusercontent.com/phun-ky/speccer/main/public/logo-speccer-horizontal-colored-package.svg?raw=true" style="max-height:32px;"/></div>';
}
};
}