typedoc-github-wiki-theme
Advanced tools
Comparing version 2.0.0-next.1 to 2.0.0-next.2
@@ -28,20 +28,30 @@ "use strict"; | ||
const fs = __importStar(require("fs")); | ||
const typedoc_plugin_markdown_1 = require("typedoc-plugin-markdown"); | ||
const theme_1 = require("./theme"); | ||
function load(app) { | ||
app.renderer.defineTheme('github-wiki', theme_1.GithubWikiTheme); | ||
app.options.addReader(new typedoc_plugin_markdown_1.MarkdownPluginOptionsReader({ | ||
theme: 'github-wiki', | ||
entryFileName: 'Home.md', | ||
flattenOutputFiles: true, | ||
skipIndexPage: true, | ||
hideInPageTOC: true, | ||
hidePageHeader: true, | ||
hideBreadcrumbs: true, | ||
hidePageTitle: true, | ||
})); | ||
app.options.addReader(new (class { | ||
constructor() { | ||
this.name = 'github-wiki-options'; | ||
this.order = 0; | ||
this.supportsPackages = false; | ||
} | ||
read(container) { | ||
Object.entries({ | ||
theme: 'github-wiki', | ||
entryFileName: 'Home.md', | ||
flattenOutputFiles: true, | ||
skipIndexPage: true, | ||
hideInPageTOC: true, | ||
hidePageHeader: true, | ||
hideBreadcrumbs: true, | ||
hidePageTitle: true, | ||
}).forEach(([key, value]) => { | ||
container.setValue(key, value); | ||
}); | ||
} | ||
})()); | ||
app.renderer.postRenderAsyncJobs.push(async (output) => { | ||
const navigation = app.renderer.theme | ||
.getRenderContext() | ||
.partials.navigation(output.navigation); | ||
.getRenderContext(null) | ||
.navigation(output.navigation); | ||
fs.writeFileSync(`${output.outputDirectory}/_Sidebar.md`, navigation); | ||
@@ -48,0 +58,0 @@ }); |
@@ -1,5 +0,9 @@ | ||
import { MarkdownTheme } from 'typedoc-plugin-markdown'; | ||
import { PageEvent, Reflection } from 'typedoc'; | ||
import { MarkdownTheme, MarkdownThemeRenderContext } from 'typedoc-plugin-markdown'; | ||
export declare class GithubWikiTheme extends MarkdownTheme { | ||
private _contextCache?; | ||
getRenderContext(): any; | ||
getRenderContext(pageEvent: PageEvent<Reflection>): ThemeRenderContext; | ||
} | ||
declare class ThemeRenderContext extends MarkdownThemeRenderContext { | ||
parseUrl(url: string): string; | ||
} | ||
export {}; |
@@ -6,7 +6,4 @@ "use strict"; | ||
class GithubWikiTheme extends typedoc_plugin_markdown_1.MarkdownTheme { | ||
getRenderContext() { | ||
if (!this._contextCache) { | ||
this._contextCache = new ThemeRenderContext(this, this.application.options); | ||
} | ||
return this._contextCache; | ||
getRenderContext(pageEvent) { | ||
return new ThemeRenderContext(pageEvent, this.application.options); | ||
} | ||
@@ -13,0 +10,0 @@ } |
{ | ||
"name": "typedoc-github-wiki-theme", | ||
"version": "2.0.0-next.1", | ||
"version": "2.0.0-next.2", | ||
"description": "A typedoc-plugin-markdown theme that publishes Markdown pages compatible with Github Wiki.", | ||
@@ -27,3 +27,3 @@ "main": "dist/index.js", | ||
"peerDependencies": { | ||
"typedoc-plugin-markdown": ">=4.0.0-next.12" | ||
"typedoc-plugin-markdown": ">=4.0.0-next.13" | ||
}, | ||
@@ -30,0 +30,0 @@ "keywords": [ |
7228
85