New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

typedoc-github-wiki-theme

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typedoc-github-wiki-theme - npm Package Compare versions

Comparing version

to
2.0.0-next.3

dist/options/presets.d.ts

2

dist/index.d.ts
import { Application } from 'typedoc';
import { NavigationItem } from 'typedoc-plugin-markdown';
export declare function load(app: Application): void;
export declare function navigation(navigationItems: NavigationItem[]): string;

41

dist/index.js

@@ -25,5 +25,9 @@ "use strict";

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.load = void 0;
exports.navigation = exports.load = void 0;
const fs = __importStar(require("fs"));
const presets_1 = __importDefault(require("./options/presets"));
const theme_1 = require("./theme");

@@ -39,12 +43,4 @@ function load(app) {

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]) => {
Object.entries(presets_1.default).forEach(([key, value]) => {
container.setValue('theme', 'github-wiki');
container.setValue(key, value);

@@ -55,8 +51,23 @@ });

app.renderer.postRenderAsyncJobs.push(async (output) => {
const navigation = app.renderer.theme
.getRenderContext(null)
.navigation(output.navigation);
fs.writeFileSync(`${output.outputDirectory}/_Sidebar.md`, navigation);
fs.writeFileSync(`${output.outputDirectory}/_Sidebar.md`, navigation(output.navigation));
});
}
exports.load = load;
function navigation(navigationItems) {
const md = [];
navigationItems.forEach((navigationItem) => {
var _a, _b;
if (navigationItem.url) {
md.push(`- [${navigationItem.title}](${navigationItem.url})`);
}
if ((_a = navigationItem.children) === null || _a === void 0 ? void 0 : _a.length) {
md.push(`## ${navigationItem.title} \n`);
(_b = navigationItem.children) === null || _b === void 0 ? void 0 : _b.forEach((navItem) => {
md.push(`- [${navItem.title}](${navItem.url})`);
});
md.push('\n');
}
});
return md.join('\n');
}
exports.navigation = navigation;

@@ -1,9 +0,8 @@

import { PageEvent, Reflection } from 'typedoc';
import { MarkdownTheme, MarkdownThemeRenderContext } from 'typedoc-plugin-markdown';
import { DeclarationReflection, ProjectReflection, Reflection } from 'typedoc';
import { MarkdownPageEvent, MarkdownTheme } from 'typedoc-plugin-markdown';
import { UrlMapping } from 'typedoc-plugin-markdown/dist/plugin/url-mapping';
export declare class GithubWikiTheme extends MarkdownTheme {
getRenderContext(pageEvent: PageEvent<Reflection>): ThemeRenderContext;
getRenderContext(pageEvent: MarkdownPageEvent<Reflection>): any;
getUrls(project: ProjectReflection): UrlMapping<any>[];
getUrl(reflection: DeclarationReflection): string;
}
declare class ThemeRenderContext extends MarkdownThemeRenderContext {
parseUrl(url: string): string;
}
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GithubWikiTheme = void 0;
const typedoc_1 = require("typedoc");
const typedoc_plugin_markdown_1 = require("typedoc-plugin-markdown");
class GithubWikiTheme extends typedoc_plugin_markdown_1.MarkdownTheme {
getRenderContext(pageEvent) {
return new ThemeRenderContext(pageEvent, this.application.options);
return new ThemeRenderContext(this, pageEvent, this.application.options);
}
getUrls(project) {
return super.getUrls(project).map((urlMapping) => {
if (urlMapping.model.kindOf(typedoc_1.ReflectionKind.Project)) {
return urlMapping;
}
return {
...urlMapping,
url: this.getUrl(urlMapping.model),
};
});
}
getUrl(reflection) {
const fullname = reflection.getFullName();
const fullnameParts = fullname.split('.');
if (!reflection.kindOf(typedoc_1.ReflectionKind.Module)) {
fullnameParts.splice(fullnameParts.length - 1, 0, typedoc_1.ReflectionKind.singularString(reflection.kind).split(' ')[0]);
}
const url = `${fullnameParts.join('.')}.md`;
reflection.url = url;
return url;
}
}

@@ -10,0 +32,0 @@ exports.GithubWikiTheme = GithubWikiTheme;

{
"name": "typedoc-github-wiki-theme",
"version": "2.0.0-next.2",
"description": "A typedoc-plugin-markdown theme that publishes Markdown pages compatible with Github Wiki.",
"version": "2.0.0-next.3",
"description": "A TypeDoc ( + typedoc-plugin-markdown ) theme that generates docs compatible with Github Wiki.",
"main": "dist/index.js",

@@ -21,4 +21,5 @@ "files": [

"prepublishOnly": "npm run lint && npm run build",
"build": "rm -rf ./dist && tsc",
"docs": "rm -rf ./demo && npm run build && typedoc --options ../../stubs/typedoc.1.js --plugin typedoc-plugin-markdown --plugin ./dist/index --out ./out"
"prebuild": "rm -rf dist && prebuild-options",
"build": "tsc",
"docs": "rm -rf ./demo && npm run build && typedoc"
},

@@ -28,3 +29,3 @@ "author": "Thomas Grey",

"peerDependencies": {
"typedoc-plugin-markdown": ">=4.0.0-next.13"
"typedoc-plugin-markdown": ">=4.0.0-next.40"
},

@@ -31,0 +32,0 @@ "keywords": [

# typedoc-github-wiki-theme
A [typedoc-plugin-markdown](https://github.com/tgreyuk/typedoc-plugin-markdown/blob/master/packages/typedoc-plugin-markdown/README.md) theme that publishes Markdown pages compatible with [Github Wiki](https://docs.github.com/en/communities/documenting-your-project-with-wikis/about-wikis).
![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.svg)](https://www.npmjs.com/package/typedoc-github-wiki-theme)
![CI](https://github.com/tgreyuk/typedoc-plugin-markdown/actions/workflows/ci.yml/badge.svg?branch=master)
A TypeDoc ( + typedoc-plugin-markdown ) theme that generates docs compatible with Github Wiki.
## What does it do?
This theme customises the output from [typedoc-plugin-markdown](https://github.com/tgreyuk/typedoc-plugin-markdown/blob/master/packages/typedoc-plugin-markdown/README.md):
- Generates Wiki friendly file names.
- Updates internal urls to a compatible format.
- Writes a `_Sidebar.md` file to enable custom sidebar navigation.
## Installation
```shell
npm install typedoc typedoc-plugin-markdown@next typedoc-github-wiki-theme@next --save-dev
```
npm install typedoc-github-wiki-theme --save-dev
```
## Usage
## Documentation
**typedoc.json**
Please visit https://typedoc-plugin-markdown.org/themes/github-wiki.
```json
{
"plugin": ["typedoc-plugin-markdown", "typedoc-github-wiki-theme"]
}
```
## Options
For options please refer to [typedoc-plugin-markdown](https://github.com/tgreyuk/typedoc-plugin-markdown/blob/master/packages/typedoc-plugin-markdown/README.md#options).
The following options are preset with the theme:
```json
{
"entryFileName": "Home.md",
"flattenOutputFiles": true,
"skipIndexPage": true,
"hideInPageTOC": true,
"hidePageHeader": true,
"hideBreadcrumbs": true,
"hidePageTitle": true
}
```
## License
[MIT](https://github.com/tgreyuk/typedoc-plugin-markdown/blob/master/packages/typedoc-github-wiki-theme/LICENSE)
```
```
Released under the [MIT License](./LICENSE).

Sorry, the diff of this file is not supported yet