Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

typedoc-plugin-markdown

Package Overview
Dependencies
Maintainers
1
Versions
250
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typedoc-plugin-markdown - npm Package Compare versions

Comparing version 0.0.12 to 1.0.0

dist/plugin.js

31

dist/index.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var declaration_1 = require("typedoc/dist/lib/utils/options/declaration");
var converterPlugin_1 = require("./plugin/converterPlugin");
var rendererPlugin_1 = require("./plugin/rendererPlugin");
var plugin_1 = require("./plugin");
module.exports = function (PluginHost) {

@@ -10,4 +9,10 @@ var app = PluginHost.owner;

component: 'markdown',
help: 'Markdown Plugin: Export to single document.',
name: 'markdownSinglePage',
help: 'Markdown Plugin: Export to single file.',
name: 'mdOutFile',
type: declaration_1.ParameterType.String,
});
app.options.addDeclaration({
component: 'markdown',
help: 'Markdown Plugin: Suppress indexes from single file output.',
name: 'mdHideIndexes',
type: declaration_1.ParameterType.Boolean,

@@ -17,5 +22,10 @@ });

component: 'markdown',
defaultValue: 'github',
help: 'Markdown Plugin: Flavour - "github" or "bitbucket"',
name: 'markdownFlavour',
help: 'Markdown Plugin: Suppress file sources from output.',
name: 'mdHideSources',
type: declaration_1.ParameterType.Boolean,
});
app.options.addDeclaration({
component: 'markdown',
help: 'Markdown Plugin: Markdown parser ie: "bitbucket"',
name: 'mdFlavour',
type: declaration_1.ParameterType.String,

@@ -26,8 +36,7 @@ });

defaultValue: '',
help: 'Markdown Plugin: Repository source file foott',
name: 'markdownSourcefilePrefix',
help: 'The repository to use for source files (ignored unless markdownFlavour is set)',
name: 'mdSourceRepo',
type: declaration_1.ParameterType.String,
});
app.converter.addComponent('markdown-converter', converterPlugin_1.MarkdownConverterPlugin);
app.renderer.addComponent('markdown-renderer', rendererPlugin_1.MarkdownRendererPlugin);
app.converter.addComponent('markdown', plugin_1.MarkdownPlugin);
};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = require("../utils");
function compileGroup(group) {
var index_1 = require("typedoc/dist/lib/models/reflections/index");
var service_1 = require("../service");
function compileGroup(group, parent) {
var options = service_1.ThemeService.getOptions();
var md = '';
if (!group.allChildrenArePrivate) {
switch (group.title) {
case 'Properties':
md = utils_1.compileTemplate("partials/members.group.properties.hbs", group);
break;
case 'Methods':
md = utils_1.compileTemplate("partials/members.group.methods.hbs", group);
break;
case 'Functions':
md = utils_1.compileTemplate("partials/members.group.functions.hbs", group);
break;
case 'Variables':
md = utils_1.compileTemplate("partials/members.group.variables.hbs", group);
break;
case 'Enumeration members':
md = utils_1.compileTemplate("partials/members.group.enums.hbs", group);
break;
default:
md = utils_1.compileTemplate("partials/members.group.hbs", group);
var displayTitle = true;
var isSinglePage = options.mdOutFile !== undefined;
var displayBackLink = isSinglePage;
var isMainTitle = options.mode === 0 && parent === undefined;
if (group.kind === index_1.ReflectionKind.ObjectLiteral ||
isSinglePage && group.kind === index_1.ReflectionKind.ExternalModule ||
isSinglePage && group.kind === index_1.ReflectionKind.Module ||
isSinglePage && group.kind === index_1.ReflectionKind.Interface ||
isSinglePage && group.kind === index_1.ReflectionKind.Class ||
isSinglePage && group.kind === index_1.ReflectionKind.Enum) {
displayTitle = false;
displayBackLink = false;
}
md = service_1.ThemeService.compilePartial("members.group.hbs", Object.assign(group, { displayTitle: displayTitle, isMainTitle: isMainTitle, displayBackLink: displayBackLink }));
}

@@ -27,0 +24,0 @@ return md;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = require("../utils");
var index_1 = require("typedoc/dist/lib/models/reflections/index");
var service_1 = require("../service");
function compileIndex(member) {
var options = service_1.ThemeService.getOptions();
var md = '';
md = utils_1.compileTemplate('partials/index.hbs', Object.assign(member));
if (member.kind !== index_1.ReflectionKind.Interface) {
if (!options.mdOutFile || (options.mdOutFile && !options.mdHideIndexes)) {
md = service_1.ThemeService.compilePartial('index.hbs', Object.assign(member));
}
}
return md;
}
exports.compileIndex = compileIndex;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var options_1 = require("../options");
var utils_1 = require("../utils");
var index_1 = require("typedoc/dist/lib/models/reflections/index");
var service_1 = require("../service");
function compileMember(member) {
var options = service_1.ThemeService.getOptions();
var md = '';
if (!(options_1.Options.excludePrivate && member.flags.isPrivate)) {
if (member.kindString === 'Object literal' ||
member.kindString === 'Constructor' ||
member.kindString === 'Method' ||
member.kindString === 'Variable' ||
member.kindString === 'Function' ||
member.kindString === 'Property') {
var templateRef = member.kindString.replace(' ', '').toLowerCase().replace(' ', '');
md = utils_1.compileTemplate("partials/member." + templateRef + ".hbs", member);
if (!(options.excludePrivate && member.flags.isPrivate)) {
switch (member.kind) {
case index_1.ReflectionKind.Class:
case index_1.ReflectionKind.Module:
case index_1.ReflectionKind.ExternalModule:
case index_1.ReflectionKind.Enum:
Object.assign(member, { displayBackLink: true, hideBreadcrumbs: true });
md = service_1.ThemeService.compileTemplate('reflection.hbs', { model: member });
break;
case index_1.ReflectionKind.Interface:
Object.assign(member, { displayBackLink: options.mode === 0 ? true : false, hideBreadcrumbs: true });
md = service_1.ThemeService.compileTemplate('reflection.hbs', { model: member });
break;
case index_1.ReflectionKind.Constructor:
md = service_1.ThemeService.compilePartial('member.constructor.hbs', member);
break;
case index_1.ReflectionKind.ObjectLiteral:
md = service_1.ThemeService.compilePartial('member.object.hbs', member);
break;
default:
md = service_1.ThemeService.compilePartial('member.hbs', member);
}
else if (member.kindString === 'Class' ||
member.kindString === 'Module' ||
member.kindString === 'External module' ||
member.kindString === 'Interface') {
Object.assign(member, { isSinglePage: options_1.Options.markdownSinglePage });
md = utils_1.compileTemplate('templates/reflection.hbs', { model: member });
}
else {
md = utils_1.compileTemplate('partials/member.hbs', member);
}
}

@@ -28,0 +31,0 @@ return md;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = require("../utils");
var index_1 = require("typedoc/dist/lib/models/reflections/index");
var service_1 = require("../service");
function compileRootMembers(member) {
var md = '';
md = utils_1.compileTemplate('partials/members.hbs', member);
if (member.kind === index_1.ReflectionKind.Interface) {
md = service_1.ThemeService.compilePartial('members.interface.hbs', member);
}
else {
md = service_1.ThemeService.compilePartial('members.hbs', member);
}
return md;
}
exports.compileRootMembers = compileRootMembers;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var options_1 = require("../options");
var utils_1 = require("../utils");
var service_1 = require("../service");
function compileSources(sources) {
return utils_1.compileTemplate("partials/member.sources.hbs", Object.assign(Object.assign(sources, {
isBitbucket: options_1.Options.markdownFlavour === 'bitbucket',
sourceRoot: options_1.Options.markdownSourcefilePrefix,
})));
var options = service_1.ThemeService.getOptions();
var md = '';
if (!options.mdHideSources) {
md = service_1.ThemeService.compilePartial('member.sources.hbs', sources);
}
return md;
}
exports.compileSources = compileSources;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Utils = require("../utils");
function getAnchor(item) {
return Utils.getAnchor(item);
var service_1 = require("../service");
function getAnchor(anchor) {
var options = service_1.ThemeService.getOptions();
return options.mdFlavour === 'bitbucket' ? '' : "<a id=\"" + anchor + "\"></a>";
}
exports.getAnchor = getAnchor;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var options_1 = require("../options");
var index_1 = require("typedoc/dist/lib/models/reflections/index");
var service_1 = require("../service");
function ifDisplayIndexItem(item, opts) {
if ((options_1.Options.excludePrivate && item.flags.isPrivate)) {
var options = service_1.ThemeService.getOptions();
if ((!item.anchor && !item.groups && item.kind !== index_1.ReflectionKind.Interface) ||
(options.excludePrivate && item.flags.isPrivate)) {
return opts.inverse(this);

@@ -7,0 +10,0 @@ }

{
"name": "typedoc-plugin-markdown",
"version": "0.0.12",
"version": "1.0.0",
"description": "A plugin for Typedoc that exposes themes and options for rendering markdown.",

@@ -10,15 +10,22 @@ "main": "dist/index.js",

"scripts": {
"compileTestOutput": "typedoc --tsconfig tests/src/tsconfig.json --options tests/config.default.json && typedoc --tsconfig tests/src/tsconfig.json --options tests/config.singlepage.json",
"copy:hbs": "cpx src/**/*.hbs dist/",
"copy:pkg": "copyfiles package.json dist/index.js dist/**/*.hbs dist/**/*.js dist/theme/helpers/*.js node_modules/typedoc-plugin-markdown",
"clean": "rm -rf dist && rm -rf test/out",
"copy:static": "copyfiles --up 1 src/**/*.hbs dist/",
"copy:plugin": "copyfiles package.json './dist/**/*' node_modules/typedoc-plugin-markdown/",
"compiletests": "npm run compiletest:default && npm run compiletest:outfile && npm run compiletest:bitbucket",
"compiletest:default": "typedoc --tsconfig tests/src/tsconfig.json --options tests/config.core.json --out tests/out/default",
"compiletest:outfile": "typedoc --tsconfig tests/src/tsconfig.json --readme none --mode file --mdOutFile API.md --mdHideSources --options tests/config.core.json --out tests/out/outfile",
"compiletest:bitbucket": "typedoc --tsconfig tests/src/tsconfig.json --excludePrivate --readme none --mode file --mdFlavour bitbucket --mdSourceRepo 'https://bitbucket.org/owner/repository_name' --options tests/config.core.json --out tests/out/bitbucket",
"lint": "tslint --type-check --project tsconfig.json",
"prepare": "tsc && npm run copy:hbs",
"prepublishOnly": "npm run lint && npm run clean && npm run test",
"pretest": "npm run prepare && npm run copy:pkg && npm run compileTestOutput",
"test": "mocha tests/index.js",
"watch": "concurrently \"npm run watch:tsc\" \"npm run watch:hbs\"",
"watch:tsc": "tsc -w",
"watch:hbs": "onchange 'src/**/*.hbs' -- npm run copy:hbs"
"prepare": "rm -rf dist && tsc && npm run copy:static",
"prepublish": "npm run prepare && npm run lint && npm run test",
"pretest": "rm -rf tests/out && rm -rf node_modules/typedoc-plugin-markdown && npm run copy:plugin && npm run compiletests",
"test": "mocha tests/**/test.*.js"
},
"author": "Thomas Grey",
"license": "MIT",
"engines": {
"node": ">=6"
},
"bugs": {
"url": "https://github.com/tgreyuk/typedoc-plugin-markdown/issues"
},
"repository": {

@@ -29,27 +36,24 @@ "type": "git",

"keywords": [
"markdown",
"typedocplugin",
"typedoc"
],
"bugs": {
"url": "https://github.com/tgreyuk/typedoc-plugin-markdown/issues"
},
"author": "Thomas Grey",
"license": "MIT",
"peerDependencies": {
"typedoc": "^0.7.0"
"typedoc": "^0.7.1"
},
"devDependencies": {
"@types/chai": "4.0.0",
"@types/mocha": "2.2.41",
"chai": "4.0.2",
"chai-files": "11.4.0",
"concurrently": "3.4.0",
"copyfiles": "1.2.0",
"cpx": "1.5.0",
"mocha": "3.4.2",
"onchange": "3.2.1",
"tslint": "5.4.3",
"typedoc": "0.7.1",
"@types/chai": "^4.0.1",
"@types/mocha": "^2.2.41",
"@types/to-markdown": "^3.0.0",
"chai": "^4.0.2",
"chai-files": "^1.4.0",
"copyfiles": "^1.2.0",
"mocha": "^3.4.2",
"tslint": "^5.4.3",
"typedoc": "^0.7.1",
"typescript": "2.3.4"
},
"dependencies": {
"to-markdown": "^3.0.4"
}
}
# typedoc-plugin-markdown
[![Build Status](https://travis-ci.org/tgreyuk/typedoc-plugin-markdown.svg?branch=master)](https://travis-ci.org/tgreyuk/typedoc-plugin-markdown)
[![npm](https://img.shields.io/npm/v/typedoc-plugin-markdown.svg)](https://www.npmjs.com/package/typedoc-plugin-markdown)
[![Greenkeeper badge](https://badges.greenkeeper.io/tgreyuk/typedoc-plugin-markdown.svg)](https://greenkeeper.io/)
*Alpha version under development. Please feel free to use with this caveat - feedback welcome.*
A plugin for [TypeDoc](https://github.com/TypeStrong/typedoc) that exposes themes and options for rendering markdown.
## Installation
## Getting started
```javascript
npm install --save-dev typedoc-plugin-markdown
npm install --save-dev typedoc typedoc-plugin-markdown
```
## Usage
### How to use

@@ -18,39 +20,58 @@ The plugin provides an additional markdown theme.

```javascript
typedoc --theme markdown
node_modules/.bin/typedoc --theme markdown
```
### Markdown options (experimental)
### Additional arguments
The plugin exposes the following additional options;
The plugin exposes the following additional arguments:
| Name | Description | Default value
| --------- | ----------- | ----
| markdownSinglePage | Export to a single file | off
| markdownFlavour | The markdown rendering engine. "github" or "bitbucket" | github
| markdownSourcefilePrefix | The prefix to use for sourcefiles. | github source file path
* `--mdOutFile <fileName.md>`<br />
Compiles output to a single file
* `--mdHideSources`<br />
Suppress sources from output
* `--mdFlavour<github|bitbucket>`<br />
Specifies the markdown rendering engine. Defaults to `github`.
* `--mdSourceRepo<path.to.repo>`<br />
The source repo to use for source file linking. Will be ignored on github flavoured projects.<br />
For bitbucket use: `https://bitbucket.org/owner/repository_name`.<br />
*Examples*:
### Why not just create a theme?
```
--markdownSourcefilePrefix https://bitbucket.org/owner/repository_name/src/master/src/
```
## Samples
Creating a pluign that exposes a theme provides a mechanism to offer a feature rich set of additional options.
Samples of generated output.
## Example output
* [Generated output from TypeDoc's examples directory](https://github.com/tgreyuk/typedoc-plugin-markdown-samples/blob/master/out/typedoc/index.md)
* [Generated from a selection of Microsoft TypeScriptSamples](https://github.com/tgreyuk/typedoc-plugin-markdown-samples/blob/master/out/microsoft/index.md)
<pre>
/**
* This is a function with multiple arguments and a return value.
* @param paramZ This is a string parameter.
* @param paramG This is a parameter flagged with any.
*/
export function functionWithArguments(paramZ:string, paramG:any):number {
return 0;
}
</pre>
## Acknowledgements
### functionWithArguments
* Thanks to kimamula's [typedoc-markdown-theme](https://github.com/kimamula/typedoc-markdown-theme) for the inspiration behind this project.
► **functionWithArguments**(paramZ: *`string`*, paramG: *`any`*): `number`
*Defined in functions.ts:41*
This is a function with multiple arguments and a return value.
**Parameters:**
| Param | Type | Description |
| ------ | ------------------- | ------------ |
| paramZ | `string` | This is a string parameter. |
| paramG | `any` | This is a parameter flagged with any.|
**Returns:** `number`
Browse the <a href="https://github.com/tgreyuk/typedoc-plugin-markdown/tree/master/tests/mocks/default">test mocks</a> to view further examples.
## Acknowledgements
* Thanks to kimamula's [typedoc-markdown-theme](https://github.com/kimamula/typedoc-markdown-theme) for the inspiration behind this project.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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