Socket
Socket
Sign inDemoInstall

vuepress-plugin-typedoc

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

vuepress-plugin-typedoc - npm Package Compare versions

Comparing version 0.5.0 to 0.6.0

dist/render.d.ts

17

CHANGELOG.md

@@ -6,2 +6,19 @@ # Change Log

# [0.6.0](https://github.com/tgreyuk/typedoc-plugin-markdown/compare/vuepress-plugin-typedoc@0.5.0...vuepress-plugin-typedoc@0.6.0) (2021-03-22)
### Bug Fixes
* Build docs before lifecycle ([#206](https://github.com/tgreyuk/typedoc-plugin-markdown/issues/206)) ([cbf177d](https://github.com/tgreyuk/typedoc-plugin-markdown/commit/cbf177d60b5db682819693f9ef14df3799ad3323))
* Improved Readme docs ([#181](https://github.com/tgreyuk/typedoc-plugin-markdown/issues/181)) ([d81f6a3](https://github.com/tgreyuk/typedoc-plugin-markdown/commit/d81f6a392303c9e6566ef15ab0d8b9236e24556d))
### Features
* Added Hugo theme / front matter support ([3cd1bf8](https://github.com/tgreyuk/typedoc-plugin-markdown/commit/3cd1bf894533966f75ccd56c1b7cd2078e7084c0))
# [0.5.0](https://github.com/tgreyuk/typedoc-plugin-markdown/compare/vuepress-plugin-typedoc@0.4.1...vuepress-plugin-typedoc@0.5.0) (2021-02-21)

@@ -8,0 +25,0 @@

6

dist/front-matter.d.ts
import { RendererComponent } from 'typedoc/dist/lib/output/components';
import { PageEvent } from 'typedoc/dist/lib/output/events';
export declare class FrontMatterComponent extends RendererComponent {
entryDocument: string;
initialize(): void;
onPageEnd(page: PageEvent): void;
getYamlString(yamlItems: {
[key: string]: string | number | boolean;
}): string;
getYamlItems(page: PageEvent): any;
getTitle(page: PageEvent): any;
escapeYAMLString(str: string): string;
}

@@ -10,3 +10,4 @@ "use strict";

exports.FrontMatterComponent = void 0;
const reflection_title_1 = require("typedoc-plugin-markdown/dist/resources/helpers/reflection-title");
const typedoc_1 = require("typedoc");
const front_matter_1 = require("typedoc-plugin-markdown/dist/utils/front-matter");
const components_1 = require("typedoc/dist/lib/converter/components");

@@ -24,28 +25,17 @@ const components_2 = require("typedoc/dist/lib/output/components");

if (page.contents) {
page.contents = page.contents
.replace(/^/, this.getYamlString(this.getYamlItems(page)) + '\n\n')
.replace(/[\r\n]{3,}/g, '\n\n');
page.contents = front_matter_1.prependYAML(page.contents, {
title: this.getTitle(page),
});
}
}
getYamlString(yamlItems) {
const yaml = `---
${Object.entries(yamlItems)
.map(([key, value]) => `${key}: ${typeof value === 'string' ? `"${this.escapeYAMLString(value)}"` : value}`)
.join('\n')}
---`;
return yaml;
}
getYamlItems(page) {
const pageTitle = this.getTitle(page);
return {
title: pageTitle,
};
}
getTitle(page) {
return reflection_title_1.reflectionTitle.call(page, false);
if (page.url === this.entryDocument && page.url !== page.project.url) {
return page.project.name;
}
return front_matter_1.getPageTitle(page);
}
escapeYAMLString(str) {
return str.replace(/([^\\])'/g, '$1\\\'').replace(/\"/g, '');
}
};
__decorate([
typedoc_1.BindOption('entryDocument')
], FrontMatterComponent.prototype, "entryDocument", void 0);
FrontMatterComponent = __decorate([

@@ -52,0 +42,0 @@ components_1.Component({ name: 'front-matter' })

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.addOptions = exports.getOptions = void 0;
const path = require("path");
const path = __importStar(require("path"));
const typedoc_1 = require("typedoc");

@@ -9,3 +28,2 @@ const DEFAULT_PLUGIN_OPTIONS = {

hideBreadcrumbs: true,
plugin: ['typedoc-plugin-markdown'],
sidebar: {

@@ -17,2 +35,3 @@ parentCategory: 'none',

},
plugin: ['none'],
watch: false,

@@ -41,11 +60,2 @@ };

}
if (opts.plugin) {
options = {
...options,
plugin: [...DEFAULT_PLUGIN_OPTIONS.plugin, ...opts.plugin],
};
}
options = {
...options,
};
return options;

@@ -52,0 +62,0 @@ };

import { PluginOptions } from './types';
export declare const typedocPlugin: (opts: PluginOptions, ctx: any) => {
name: string;
ready(): Promise<void>;
enhanceAppFiles(): Promise<{

@@ -9,2 +8,2 @@ name: string;

} | undefined>;
};
} | undefined;
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.typedocPlugin = void 0;
const typedoc_1 = require("typedoc");
const typedoc_plugin_markdown_1 = __importDefault(require("typedoc-plugin-markdown"));
const front_matter_1 = require("./front-matter");
const options_1 = require("./options");
const render_1 = require("./render");
const sidebar_1 = require("./sidebar");
let app;
let project;
const done = false;
const typedocPlugin = (opts, ctx) => {
const options = options_1.getOptions(opts);
app = new typedoc_1.Application();
typedoc_plugin_markdown_1.default(app);
app.renderer.render = render_1.render;
options_1.addOptions(app);
app.bootstrap(options);
app.renderer.addComponent('fm', new front_matter_1.FrontMatterComponent(app.renderer));
project = app.convert();
// if project is undefined typedoc has a problem - error logging will be supplied by typedoc.
if (!project) {
return;
}
const outputDirectory = ctx.sourceDir + '/' + options.out;
app.generateDocs(project, outputDirectory);
if (options.watch) {
app.convertAndWatch(async (project) => {
app.generateDocs(project, outputDirectory);
});
}
return {
name: 'vuepress-plugin-typedoc',
async ready() {
if (!done) {
app = new typedoc_1.Application();
const sourceDir = ctx.sourceDir;
const outputDirectory = sourceDir + '/' + options.out;
options_1.addOptions(app);
app.bootstrap(options);
app.renderer.addComponent('fm', new front_matter_1.FrontMatterComponent(app.renderer));
project = app.convert();
if (!project) {
return;
}
await app.generateDocs(project, outputDirectory);
if (options.watch) {
app.convertAndWatch(async (project) => {
await app.generateDocs(project, outputDirectory);
});
}
}
},
async enhanceAppFiles() {
if (done || !options.sidebar) {
if (!options.sidebar) {
return;

@@ -38,0 +40,0 @@ }

{
"name": "vuepress-plugin-typedoc",
"version": "0.5.0",
"version": "0.6.0",
"description": "A VuePress plugin to build api documentation with TypeDoc.",

@@ -20,15 +20,12 @@ "main": "dist/index.js",

"typedoc": ">=0.20.19",
"typedoc-plugin-markdown": ">=3.4.0"
"typedoc-plugin-markdown": ">=3.6.0"
},
"devDependencies": {
"typedoc-plugin-markdown": "^3.5.0"
},
"scripts": {
"lint": "eslint ./src --ext .ts",
"prepublishOnly": "npm run lint && npm run build && npm run test",
"prepublishOnly": "yarn run lint && yarn run build && yarn run test",
"build": "rm -rf ./dist && tsc",
"test:init": "rm -rf test/site && yarn create vuepress-site test/site",
"test:demo:start": "rm -rf ./test/site/docs/api && yarn run build && cd test/site/docs && npm run dev",
"test:demo:build": "yarn run build && cd demo && yarn run build && npx http-server docs/.vuepress/dist -o",
"test": "jest --colors --updateSnapshot",
"test:demo:start": "rm -rf ./test/site/docs/api && yarn run build && cd test/site/docs && yarn run dev",
"test:demo:build": "rm -rf ./test/site/docs/api && yarn run build && cd test/site/docs && yarn run build && npx http-server ./src/.vuepress/dist -o",
"test": "jest --colors",
"build-and-test": "npm run build && npm run test"

@@ -46,3 +43,3 @@ },

],
"gitHead": "b501849a4e4fabbcb6aa8d303164c93cde0c0495"
"gitHead": "dc08967d5212261226b8fe8ce989e9e800b354b8"
}
# vuepress-plugin-typedoc
A [VuePress](https://vuepress.vuejs.org/) plugin to build API documentation with [TypeDoc](https://github.com/TypeStrong/typedoc) and the [Markdown plugin](https://github.com/tgreyuk/typedoc-plugin-markdown/tree/master/packages/typedoc-plugin-markdown).
A [VuePress](https://vuepress.vuejs.org/) plugin to build API docs with [typedoc](https://github.com/TypeStrong/typedoc) and the [typedoc-plugin-markdown](https://github.com/tgreyuk/typedoc-plugin-markdown/tree/master/packages/typedoc-plugin-markdown).

@@ -16,2 +16,4 @@ [![npm](https://img.shields.io/npm/v/vuepress-plugin-typedoc.svg)](https://www.npmjs.com/package/vuepress-plugin-typedoc)

> Install in the same location as the VuePress root directory.
This guide assumes that a VuePress project has been setup. See [getting started docs](https://vuepress.vuejs.org/guide/getting-started.html).

@@ -23,7 +25,6 @@

_Install in the same location as the VuePress root directory._
### Config
## Usage
Add the plugin to `.vuepress/config.js` and specify the required options (see [options](#options)).
Add the plugin to `.vuepress/config.js`:

@@ -35,3 +36,3 @@ ```js

// Plugin / TypeDoc options (see typedoc --help)
// Plugin / TypeDoc options
{

@@ -45,2 +46,21 @@ entryPoints: ['../src/index.ts'],

TypeDoc will be bootstraped with the Vuepress `dev` and `build` [cli commands](https://vuepress.vuejs.org/api/cli.html):
```javascript
"dev": "vuepress dev [targetDir]",
"build": "vuepress build [targetDir]",
```
Once built the docs will be available at `/api` or equivalent out directory.
```
docs/ (Vuepress website root)
β”œβ”€β”€ src/
β”‚ └── .vuepress
β”‚ β”‚ └───config.js
β”‚ β”‚ └───dist/ (static site dir)
β”‚ └── api/ (compiled typedoc markdown)
β”œβ”€β”€ package.json
```
## Options

@@ -50,2 +70,4 @@

To configure TypeDoc, pass any relevant [TypeDoc options](https://typedoc.org/guides/options/) to the config.
At a minimum the `entryPoints` and `tsconfig` options will need to be set.

@@ -58,33 +80,21 @@

Please refer to [TypeDoc]() for further options.
Additional TypeDoc plugins will need to be explicitly set:
```js
plugin:['typedoc-plugin-xyz']
```
### Plugin options
**out**`<string>`
| Name | Default | Description |
| :------------------------------ | :------- | :--------------------------------------------------------------------------------- |
| `out` | `"api"` | Output directory relative to docs directory. |
| `allReflectionsHaveOwnDocument` | `false` | Output all reflections into seperate output files. |
| `hideInPageTOC` | `false` | Do not render in-page table of contents items. |
| `sidebar.fullNames` | `false` | Display full names with module path if applicable. |
| `sidebar.parentCategory` | `"none"` | The parent category label for sidebar - (defaults to `none` - no parent category). |
- Output directory relative to docs directory. Defaults to `"api"`.
**allReflectionsHaveOwnDocument**`<boolean>`
### Example config
- Output all reflections into seperate output files. Defaults to `false`.
**hideInPageTOC**`<boolean>`
- Do not render in-page table of contents items. Defaults to `false`.
**sidebar**`<object>`
- Options object for auto generated sidebar. (pass `null` to skip generation completely)
- **fullNames**`<object>`
Display full names with module path if applicable. Default to `false`.
- **parentCategory**`<string>`
The parent category label for sidebar - (defaults to `none` - no parent category)
## Full example
```js

@@ -112,2 +122,6 @@

Once built the docs will be available at `/api` or equivalent out directory.
Once built the docs will be available at `/api` or equivalent out directory.
## License
[MIT](https://github.com/tgreyuk/typedoc-plugin-markdown/blob/master/packages/vuepress-plugin-typedoc/LICENSE)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚑️ by Socket Inc