typedoc-github-wiki-theme
Advanced tools
Comparing version 2.0.0-next.6 to 2.0.0-next.7
@@ -57,2 +57,7 @@ "use strict"; | ||
})()); | ||
app.renderer.on(typedoc_plugin_markdown_1.MarkdownPageEvent.END, (page) => { | ||
page.contents = page.contents?.replace(/\[([^\]]+)\]\((?!https?:|\/|\.)([^)]+)\)/g, (match, text, url) => { | ||
return `[${text}](${encodeURI('../wiki/' + url.replace('.md', ''))})`; | ||
}); | ||
}); | ||
app.renderer.postRenderAsyncJobs.push(async (output) => { | ||
@@ -74,3 +79,3 @@ const sidebarOptions = { | ||
function getSidebar(navigationItems, outputFileStrategy) { | ||
const parseUrl = (url) => '../wiki/' + url.replace('.md', ''); | ||
const parseSidebarUrl = (url) => '../wiki/' + url.replace('.md', ''); | ||
const md = []; | ||
@@ -83,3 +88,3 @@ const isGlobals = navigationItems?.every((child) => !Boolean(child.url)); | ||
const childList = navigationItem.children | ||
?.map((child) => `- [${child.title}](${parseUrl(child.url || '')})`) | ||
?.map((child) => `- [${child.title}](${parseSidebarUrl(child.url || '')})`) | ||
.join('\n'); | ||
@@ -99,3 +104,3 @@ md.push(childList); | ||
const childList = child.children | ||
?.map((innerChild) => `- [${innerChild.title}](${innerChild.url ? parseUrl(innerChild.url) : ''})`) | ||
?.map((innerChild) => `- [${innerChild.title}](${innerChild.url ? parseSidebarUrl(innerChild.url) : ''})`) | ||
.join('\n'); | ||
@@ -110,3 +115,3 @@ md.push(childList); | ||
const childList = navigationItems | ||
?.map((navItem) => `- [${navItem.title}](${navItem.url ? parseUrl(navItem.url) : ''})`) | ||
?.map((navItem) => `- [${navItem.title}](${navItem.url ? parseSidebarUrl(navItem.url) : ''})`) | ||
.join('\n'); | ||
@@ -113,0 +118,0 @@ md.push(childList); |
@@ -1,7 +0,6 @@ | ||
import { DeclarationReflection, ProjectReflection, Reflection } from 'typedoc'; | ||
import { MarkdownPageEvent, MarkdownTheme } from 'typedoc-plugin-markdown'; | ||
import { DeclarationReflection, ProjectReflection } from 'typedoc'; | ||
import { MarkdownTheme } from 'typedoc-plugin-markdown'; | ||
export declare class GithubWikiTheme extends MarkdownTheme { | ||
getRenderContext(pageEvent: MarkdownPageEvent<Reflection>): any; | ||
getUrls(project: ProjectReflection): import("typedoc-plugin-markdown").UrlMapping<Reflection>[]; | ||
getUrls(project: ProjectReflection): import("typedoc-plugin-markdown/dist/theme").UrlMapping<import("typedoc").Reflection>[]; | ||
getUrl(reflection: DeclarationReflection): string; | ||
} |
@@ -7,8 +7,5 @@ "use strict"; | ||
class GithubWikiTheme extends typedoc_plugin_markdown_1.MarkdownTheme { | ||
getRenderContext(pageEvent) { | ||
return new ThemeRenderContext(this, pageEvent, this.application.options); | ||
} | ||
getUrls(project) { | ||
return super.getUrls(project).map((urlMapping) => { | ||
if (urlMapping.model.kindOf(typedoc_1.ReflectionKind.Project)) { | ||
if (urlMapping.model.kind === typedoc_1.ReflectionKind.Project) { | ||
return urlMapping; | ||
@@ -25,3 +22,3 @@ } | ||
const fullnameParts = fullname.split('.'); | ||
if (!reflection.kindOf(typedoc_1.ReflectionKind.Module)) { | ||
if (reflection.kind !== typedoc_1.ReflectionKind.Module) { | ||
fullnameParts.splice(fullnameParts.length - 1, 0, typedoc_1.ReflectionKind.singularString(reflection.kind).split(' ')[0]); | ||
@@ -35,12 +32,1 @@ } | ||
exports.GithubWikiTheme = GithubWikiTheme; | ||
class ThemeRenderContext extends typedoc_plugin_markdown_1.MarkdownThemeRenderContext { | ||
constructor() { | ||
super(...arguments); | ||
this.helpers = { | ||
...this.helpers, | ||
parseUrl: (url) => { | ||
return encodeURI('../wiki/' + url.replace('.md', '')); | ||
}, | ||
}; | ||
} | ||
} |
{ | ||
"name": "typedoc-github-wiki-theme", | ||
"version": "2.0.0-next.6", | ||
"version": "2.0.0-next.7", | ||
"description": "A TypeDoc ( + typedoc-plugin-markdown ) theme that generates docs compatible with Github Wiki.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
# typedoc-github-wiki-theme | ||
![npm](https://img.shields.io/npm/v/typedoc-github-wiki-theme%2Fnext?&logo=npm) ![Downloads](https://img.shields.io/npm/dm/typedoc-github-wiki-theme) [![Build Status](https://github.com/tgreyuk/typedoc-plugin-markdown/actions/workflows/ci.yml/badge.svg?branch=next)](https://github.com/tgreyuk/typedoc-plugin-markdown/actions/workflows/ci.yml) | ||
![npm](https://img.shields.io/npm/v/typedoc-github-wiki-theme%2Fnext?&logo=npm) [![Build Status](https://github.com/tgreyuk/typedoc-plugin-markdown/actions/workflows/ci.yml/badge.svg?branch=next)](https://github.com/tgreyuk/typedoc-plugin-markdown/actions/workflows/ci.yml) | ||
@@ -15,6 +15,2 @@ A TypeDoc ( + typedoc-plugin-markdown ) theme that generates docs compatible with Github Wiki. | ||
Please visit https://typedoc-plugin-markdown.org/themes/github-wiki. | ||
## License | ||
Released under the [MIT License](./LICENSE). | ||
Please visit [typedoc-plugin-markdown.org](https://typedoc-plugin-markdown.org/themes/github-wiki/introduction) for comprehensive documentation, including options and usage guides. |
12294
247
15