typedoc-plugin-markdown
Advanced tools
Comparing version 1.1.20 to 1.1.21
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var declaration_1 = require("typedoc/dist/lib/utils/options/declaration"); | ||
var plugin_1 = require("./plugin"); | ||
module.exports = function (PluginHost) { | ||
var app = PluginHost.owner; | ||
const declaration_1 = require("typedoc/dist/lib/utils/options/declaration"); | ||
const plugin_1 = require("./plugin"); | ||
module.exports = (PluginHost) => { | ||
const app = PluginHost.owner; | ||
if (app.converter.hasComponent('markdown')) { | ||
@@ -36,3 +36,3 @@ return; | ||
}); | ||
app.converter.addComponent('markdown', plugin_1.MarkdownPlugin); | ||
app.converter.addComponent('markdown', new plugin_1.MarkdownPlugin(app.converter)); | ||
}; |
"use strict"; | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = function (d, b) { | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
} | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
@@ -22,47 +9,38 @@ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var path = require("path"); | ||
var components_1 = require("typedoc/dist/lib/converter/components"); | ||
var converter_1 = require("typedoc/dist/lib/converter/converter"); | ||
var events_1 = require("typedoc/dist/lib/output/events"); | ||
var options_1 = require("typedoc/dist/lib/utils/options"); | ||
var theme_1 = require("./theme/"); | ||
var MarkdownPlugin = (function (_super) { | ||
__extends(MarkdownPlugin, _super); | ||
function MarkdownPlugin() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
const path = require("path"); | ||
const components_1 = require("typedoc/dist/lib/converter/components"); | ||
const converter_1 = require("typedoc/dist/lib/converter/converter"); | ||
const events_1 = require("typedoc/dist/lib/output/events"); | ||
const options_1 = require("typedoc/dist/lib/utils/options"); | ||
const theme_1 = require("./theme/"); | ||
let MarkdownPlugin = class MarkdownPlugin extends components_1.ConverterComponent { | ||
initialize() { | ||
this.listenTo(this.owner, { | ||
[converter_1.Converter.EVENT_RESOLVE_BEGIN]: this.onBegin, | ||
}); | ||
this.listenTo(this.application.renderer, { | ||
[events_1.PageEvent.END]: this.onPageEnd, | ||
}); | ||
} | ||
MarkdownPlugin.prototype.initialize = function () { | ||
var _a, _b; | ||
this.listenTo(this.owner, (_a = {}, | ||
_a[converter_1.Converter.EVENT_RESOLVE_BEGIN] = this.onBegin, | ||
_a)); | ||
this.listenTo(this.application.renderer, (_b = {}, | ||
_b[events_1.PageEvent.END] = this.onPageEnd, | ||
_b)); | ||
}; | ||
MarkdownPlugin.prototype.onBegin = function (context, reflection) { | ||
var renderer = this.application.renderer; | ||
var options = this.application.options; | ||
onBegin(context, reflection) { | ||
const renderer = this.application.renderer; | ||
const options = this.application.options; | ||
options.read({}, options_1.OptionsReadMode.Prefetch); | ||
var themeName = options.getValue('theme'); | ||
var themePath = this.getThemeDirectory(); | ||
const themeName = options.getValue('theme'); | ||
const themePath = this.getThemeDirectory(); | ||
if (themeName === 'markdown') { | ||
var markdownTheme = new theme_1.MarkdownTheme(renderer, themePath, options.getRawValues()); | ||
const markdownTheme = new theme_1.MarkdownTheme(renderer, themePath, options.getRawValues()); | ||
renderer.theme = renderer.addComponent('theme', markdownTheme); | ||
} | ||
else { | ||
this.application.logger.log('To generate markdown please set option --theme markdown'); | ||
} | ||
}; | ||
MarkdownPlugin.prototype.onPageEnd = function (page) { | ||
page.contents = page.contents.replace(/\n{3,}/g, '\n\n'); | ||
}; | ||
MarkdownPlugin.prototype.getThemeDirectory = function () { | ||
} | ||
onPageEnd(page) { | ||
page.contents = page.contents ? page.contents.replace(/\n{3,}/g, '\n\n') : ''; | ||
} | ||
getThemeDirectory() { | ||
return path.join(__dirname, './theme/'); | ||
}; | ||
MarkdownPlugin = __decorate([ | ||
components_1.Component({ name: 'markdown' }) | ||
], MarkdownPlugin); | ||
return MarkdownPlugin; | ||
}(components_1.ConverterComponent)); | ||
} | ||
}; | ||
MarkdownPlugin = __decorate([ | ||
components_1.Component({ name: 'markdown' }) | ||
], MarkdownPlugin); | ||
exports.MarkdownPlugin = MarkdownPlugin; |
"use strict"; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var props_1 = require("../props"); | ||
var utils_1 = require("../utils"); | ||
const props_1 = require("../props"); | ||
const utils_1 = require("../utils"); | ||
function compileGroup(group, parentKind) { | ||
var options = props_1.getOptions(); | ||
var md = ''; | ||
const options = props_1.getOptions(); | ||
let md = ''; | ||
if (!options.excludePrivate || !group.allChildrenArePrivate) { | ||
md = utils_1.compilePartial('members.group.hbs', __assign({}, group)); | ||
md = utils_1.compilePartial('members.group.hbs', Object.assign({}, group)); | ||
} | ||
@@ -22,0 +11,0 @@ return md; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var props_1 = require("../props"); | ||
var utils_1 = require("../utils"); | ||
const props_1 = require("../props"); | ||
const utils_1 = require("../utils"); | ||
function compileSources(sources) { | ||
var options = props_1.getOptions(); | ||
var md = ''; | ||
const options = props_1.getOptions(); | ||
let md = ''; | ||
if (!options.mdHideSources) { | ||
@@ -9,0 +9,0 @@ md = utils_1.compilePartial('member.sources.hbs', sources); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var utils_1 = require("../utils"); | ||
const utils_1 = require("../utils"); | ||
function getAnchor(anchor) { | ||
return utils_1.getMarkdownEngine() === 'bitbucket' ? '' : "<a id=\"" + anchor + "\"></a>"; | ||
return utils_1.getMarkdownEngine() === 'bitbucket' ? '' : `<a id="${anchor}"></a>`; | ||
} | ||
exports.getAnchor = getAnchor; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var utils_1 = require("../utils"); | ||
const utils_1 = require("../utils"); | ||
function getHeadingLevel(baseLevel) { | ||
@@ -5,0 +5,0 @@ return utils_1.getMarkdownEngine() === 'gitbook' |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function getHierachySymbol(item) { | ||
var symbol = ''; | ||
let symbol = ''; | ||
if (item.reflection) { | ||
@@ -6,0 +6,0 @@ symbol = item.reflection.extendedTypes ? '↳ ' : ''; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var TurndownService = require('turndown'); | ||
var turndownService = new TurndownService({ | ||
const TurndownService = require('turndown'); | ||
const turndownService = new TurndownService({ | ||
codeBlockStyle: 'fenced', | ||
@@ -6,0 +6,0 @@ }); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var utils_1 = require("../utils"); | ||
const utils_1 = require("../utils"); | ||
function getMemberGroupHeadingLevel() { | ||
@@ -5,0 +5,0 @@ return utils_1.getMarkdownEngine() === 'gitbook' ? '#' : '##'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var index_1 = require("typedoc/dist/lib/models/reflections/index"); | ||
var utils_1 = require("../utils"); | ||
const index_1 = require("typedoc/dist/lib/models/reflections/index"); | ||
const utils_1 = require("../utils"); | ||
function getMemberHeadingLevel(member) { | ||
var headingLevel = utils_1.getMarkdownEngine() === 'gitbook' ? '##' : '###'; | ||
if (member.parent.kind === index_1.ReflectionKind.ObjectLiteral) { | ||
let headingLevel = utils_1.getMarkdownEngine() === 'gitbook' ? '##' : '###'; | ||
if (member.parent && member.parent.kind === index_1.ReflectionKind.ObjectLiteral) { | ||
headingLevel = headingLevel + '#'; | ||
@@ -9,0 +9,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function getMemberSymbol(kindString) { | ||
var symbol = ''; | ||
let symbol = ''; | ||
switch (kindString) { | ||
@@ -6,0 +6,0 @@ case 'Constructor signature': |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function getParametersTableHeaders(parameters) { | ||
var headers = ['Name', 'Type', 'Default value', 'Description']; | ||
var hasDefaultValues = parameters.find(function (param) { | ||
let headers = ['Name', 'Type', 'Default value', 'Description']; | ||
const hasDefaultValues = parameters.find((param) => { | ||
return param.defaultValue; | ||
}); | ||
var hasComments = parameters.find(function (param) { | ||
const hasComments = parameters.find((param) => { | ||
return param.comment; | ||
}); | ||
if (!hasDefaultValues) { | ||
headers = headers.filter(function (header) { | ||
headers = headers.filter((header) => { | ||
return header !== 'Default value'; | ||
@@ -17,3 +17,3 @@ }); | ||
else { | ||
parameters.forEach(function (param) { | ||
parameters.forEach((param) => { | ||
param.defaultValue = param.defaultValue ? param.defaultValue : '-'; | ||
@@ -23,14 +23,14 @@ }); | ||
if (!hasComments) { | ||
headers = headers.filter(function (header) { | ||
headers = headers.filter((header) => { | ||
return header !== 'Description'; | ||
}); | ||
} | ||
var md = '|'; | ||
headers.forEach(function (header) { | ||
md += " " + header + " |"; | ||
let md = '|'; | ||
headers.forEach((header) => { | ||
md += ` ${header} |`; | ||
}); | ||
md += '\n'; | ||
md += '|'; | ||
headers.forEach(function () { | ||
md += " ------ |"; | ||
headers.forEach(() => { | ||
md += ` ------ |`; | ||
}); | ||
@@ -37,0 +37,0 @@ return md; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var props_1 = require("../props"); | ||
var utils_1 = require("../utils"); | ||
const props_1 = require("../props"); | ||
const utils_1 = require("../utils"); | ||
function getSourceFile(fileName, line, url) { | ||
var options = props_1.getOptions(); | ||
var md = 'Defined in '; | ||
const options = props_1.getOptions(); | ||
let md = 'Defined in '; | ||
if (utils_1.getMarkdownEngine() === 'bitbucket' && options.mdSourceRepo) { | ||
var bitbucketUrl = options.mdSourceRepo + "/src/master/" + fileName; | ||
var bitbucketParams = "fileviewer=file-view-default#" + fileName + "-" + line; | ||
md += "[" + fileName + ":" + line + "](" + bitbucketUrl + "?" + bitbucketParams + ")"; | ||
const bitbucketUrl = `${options.mdSourceRepo}/src/master/${fileName}`; | ||
const bitbucketParams = `fileviewer=file-view-default#${fileName}-${line}`; | ||
md += `[${fileName}:${line}](${bitbucketUrl}?${bitbucketParams})`; | ||
} | ||
else if (url) { | ||
md += "[" + fileName + ":" + line + "](" + url + ")"; | ||
md += `[${fileName}:${line}](${url})`; | ||
} | ||
else { | ||
md += fileName + ":" + line; | ||
md += `${fileName}:${line}`; | ||
} | ||
@@ -19,0 +19,0 @@ return md; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var utils_1 = require("../utils"); | ||
const utils_1 = require("../utils"); | ||
function getStrippedComment(comment) { | ||
var lineBreak = utils_1.getMarkdownEngine() === 'bitbucket' ? ' ' : '<br><br>'; | ||
var newComment = ''; | ||
const lineBreak = utils_1.getMarkdownEngine() === 'bitbucket' ? ' ' : '<br><br>'; | ||
let newComment = ''; | ||
if (comment) { | ||
@@ -8,0 +8,0 @@ if (comment.text) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function ifContainsDefaultValues(parameters) { | ||
var hasDefaultValues = false; | ||
parameters.forEach(function (param) { | ||
let hasDefaultValues = false; | ||
parameters.forEach((param) => { | ||
if (param.defaultValue) { | ||
@@ -7,0 +7,0 @@ hasDefaultValues = true; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var utils_1 = require("../utils"); | ||
const utils_1 = require("../utils"); | ||
function ifDisplayBreadcrumbs(opts) { | ||
@@ -5,0 +5,0 @@ return utils_1.getMarkdownEngine() === 'gitbook' ? opts.inverse(this) : opts.fn(this); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var index_1 = require("typedoc/dist/lib/models/reflections/index"); | ||
var utils_1 = require("../utils"); | ||
const index_1 = require("typedoc/dist/lib/models/reflections/index"); | ||
const utils_1 = require("../utils"); | ||
function ifDisplayIndex(member, opts) { | ||
var isGitBook = utils_1.getMarkdownEngine() === 'gitbook'; | ||
var classModule = member.children && member.children.length | ||
const isGitBook = utils_1.getMarkdownEngine() === 'gitbook'; | ||
const classModule = member.children && member.children.length | ||
? member.children[0].kind === index_1.ReflectionKind.Class | ||
: false; | ||
var enumModule = member.children && member.children.length | ||
const enumModule = member.children && member.children.length | ||
? member.children[0].kind === index_1.ReflectionKind.Enum | ||
: false; | ||
var interfaceModule = member.children && member.children.length | ||
const interfaceModule = member.children && member.children.length | ||
? member.children[0].kind === index_1.ReflectionKind.Interface | ||
@@ -15,0 +15,0 @@ : false; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var props_1 = require("../props"); | ||
const props_1 = require("../props"); | ||
function ifDisplayIndexItem(item, opts) { | ||
var options = props_1.getOptions(); | ||
const options = props_1.getOptions(); | ||
if ((item.children && item.children.length === 0) || | ||
@@ -7,0 +7,0 @@ (options.excludePrivate && item.flags.isPrivate)) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var utils_1 = require("../utils"); | ||
const utils_1 = require("../utils"); | ||
function ifDisplayMainTitle(item, opts) { | ||
@@ -5,0 +5,0 @@ if (utils_1.getMarkdownEngine() === 'gitbook' || item.model.displayReadme) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var props_1 = require("../props"); | ||
const props_1 = require("../props"); | ||
function ifGroupContainesVisibleItems(group, opts) { | ||
var options = props_1.getOptions(); | ||
const options = props_1.getOptions(); | ||
if (!options.excludePrivate || !group.allChildrenArePrivate) { | ||
@@ -7,0 +7,0 @@ return opts.fn(this); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function ifHasTypeDeclarations(parameters, opts) { | ||
var hasTypeDeclaration = parameters.find(function (param) { | ||
const hasTypeDeclaration = parameters.find((param) => { | ||
return param.type.declaration && param.type.declaration.children; | ||
@@ -6,0 +6,0 @@ }); |
"use strict"; | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = function (d, b) { | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
} | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var fs = require("fs"); | ||
var path = require("path"); | ||
var index_1 = require("typedoc/dist/lib/models/reflections/index"); | ||
var UrlMapping_1 = require("typedoc/dist/lib/output/models/UrlMapping"); | ||
var DefaultTheme_1 = require("typedoc/dist/lib/output/themes/DefaultTheme"); | ||
var props_1 = require("./props"); | ||
var utils_1 = require("./utils"); | ||
var MarkdownTheme = (function (_super) { | ||
__extends(MarkdownTheme, _super); | ||
function MarkdownTheme(renderer, basePath, options) { | ||
var _this = _super.call(this, renderer, basePath) || this; | ||
renderer.removeComponent('assets'); | ||
renderer.removeComponent('javascript-index'); | ||
renderer.removeComponent('toc'); | ||
renderer.removeComponent('pretty-print'); | ||
props_1.setProps(options, _this.resources); | ||
return _this; | ||
} | ||
MarkdownTheme.buildUrls = function (reflection, urls) { | ||
var mapping = DefaultTheme_1.DefaultTheme.getMapping(reflection); | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
const index_1 = require("typedoc/dist/lib/models/reflections/index"); | ||
const UrlMapping_1 = require("typedoc/dist/lib/output/models/UrlMapping"); | ||
const DefaultTheme_1 = require("typedoc/dist/lib/output/themes/DefaultTheme"); | ||
const props_1 = require("./props"); | ||
const utils_1 = require("./utils"); | ||
class MarkdownTheme extends DefaultTheme_1.DefaultTheme { | ||
static buildUrls(reflection, urls) { | ||
const mapping = DefaultTheme_1.DefaultTheme.getMapping(reflection); | ||
if (mapping) { | ||
if (!reflection.url || !DefaultTheme_1.DefaultTheme.URL_PREFIX.test(reflection.url)) { | ||
var url = [ | ||
mapping.directory, | ||
DefaultTheme_1.DefaultTheme.getUrl(reflection) + '.md', | ||
].join('/'); | ||
const url = [mapping.directory, DefaultTheme_1.DefaultTheme.getUrl(reflection) + '.md'].join('/'); | ||
urls.push(new UrlMapping_1.UrlMapping(url, reflection, mapping.template)); | ||
@@ -57,37 +20,39 @@ reflection.url = url; | ||
} | ||
for (var key in reflection.children) { | ||
if (reflection.children.hasOwnProperty(key)) { | ||
var child = reflection.children[key]; | ||
if (mapping.isLeaf) { | ||
MarkdownTheme.applyAnchorUrl(child, reflection); | ||
if (reflection.children) { | ||
for (const key in reflection.children) { | ||
if (reflection.children.hasOwnProperty(key)) { | ||
const child = reflection.children[key]; | ||
if (mapping.isLeaf) { | ||
MarkdownTheme.applyAnchorUrl(child, reflection); | ||
} | ||
else { | ||
MarkdownTheme.buildUrls(child, urls); | ||
} | ||
} | ||
else { | ||
MarkdownTheme.buildUrls(child, urls); | ||
} | ||
} | ||
} | ||
} | ||
else { | ||
else if (reflection.parent) { | ||
MarkdownTheme.applyAnchorUrl(reflection, reflection.parent); | ||
} | ||
return urls; | ||
}; | ||
MarkdownTheme.applyAnchorUrl = function (reflection, container) { | ||
} | ||
static applyAnchorUrl(reflection, container) { | ||
if (!reflection.url || !DefaultTheme_1.DefaultTheme.URL_PREFIX.test(reflection.url)) { | ||
var anchor = DefaultTheme_1.DefaultTheme.getUrl(reflection, container, '.'); | ||
let anchor = DefaultTheme_1.DefaultTheme.getUrl(reflection, container, '.'); | ||
if (reflection['isStatic']) { | ||
anchor = 'static-' + anchor; | ||
} | ||
var anchorRef = anchor; | ||
let anchorRef = anchor; | ||
if (utils_1.getMarkdownEngine() === 'bitbucket') { | ||
var anchorPrefix_1 = ''; | ||
let anchorPrefix = ''; | ||
if (reflection.kind === index_1.ReflectionKind.ObjectLiteral) { | ||
anchorPrefix_1 += 'object-literal-'; | ||
anchorPrefix += 'object-literal-'; | ||
} | ||
reflection.flags.forEach(function (flag) { | ||
anchorPrefix_1 += flag + "-"; | ||
reflection.flags.forEach(flag => { | ||
anchorPrefix += `${flag}-`; | ||
}); | ||
var prefixRef = utils_1.getAnchorRef(anchorPrefix_1); | ||
var reflectionRef = utils_1.getAnchorRef(reflection.name); | ||
anchorRef = "markdown-header-" + prefixRef + reflectionRef; | ||
const prefixRef = utils_1.getAnchorRef(anchorPrefix); | ||
const reflectionRef = utils_1.getAnchorRef(reflection.name); | ||
anchorRef = `markdown-header-${prefixRef}${reflectionRef}`; | ||
} | ||
@@ -99,3 +64,3 @@ reflection.url = | ||
} | ||
reflection.traverse(function (child) { | ||
reflection.traverse((child) => { | ||
if (child instanceof index_1.DeclarationReflection) { | ||
@@ -105,12 +70,20 @@ MarkdownTheme.applyAnchorUrl(child, container); | ||
}); | ||
}; | ||
MarkdownTheme.prototype.isOutputDirectory = function (outPath) { | ||
var files = fs.readdirSync(outPath); | ||
} | ||
constructor(renderer, basePath, options) { | ||
super(renderer, basePath); | ||
renderer.removeComponent('assets'); | ||
renderer.removeComponent('javascript-index'); | ||
renderer.removeComponent('toc'); | ||
renderer.removeComponent('pretty-print'); | ||
props_1.setProps(options, this.resources); | ||
} | ||
isOutputDirectory(outPath) { | ||
const files = fs.readdirSync(outPath); | ||
return (fs.existsSync(path.join(outPath, 'README.md')) || | ||
(files.length === 1 && path.extname(files[0]) === '.md')); | ||
}; | ||
MarkdownTheme.prototype.getUrls = function (project) { | ||
var urlMappings = []; | ||
var entryPoint = this.getEntryPoint(project); | ||
urlMappings.push(new UrlMapping_1.UrlMapping('README.md', __assign({}, entryPoint, { | ||
} | ||
getUrls(project) { | ||
const urlMappings = []; | ||
const entryPoint = this.getEntryPoint(project); | ||
urlMappings.push(new UrlMapping_1.UrlMapping('README.md', Object.assign({}, entryPoint, { | ||
displayReadme: this.application.options.getValue('readme') !== 'none', | ||
@@ -120,3 +93,3 @@ isIndex: true, | ||
if (entryPoint.children) { | ||
entryPoint.children.forEach(function (child) { | ||
entryPoint.children.forEach((child) => { | ||
MarkdownTheme.buildUrls(child, urlMappings); | ||
@@ -126,24 +99,26 @@ }); | ||
if (utils_1.getMarkdownEngine() === 'gitbook') { | ||
var navigation = this.getNavigation(project).children.map(function (navigationItem) { | ||
var dedicatedUrls = navigationItem.dedicatedUrls | ||
? navigationItem.dedicatedUrls.map(function (url) { | ||
return { | ||
title: function () { | ||
var urlMapping = urlMappings.find(function (item) { | ||
return item.url === url; | ||
}); | ||
return urlMapping ? urlMapping.model.name : null; | ||
}, | ||
url: url, | ||
}; | ||
}) | ||
: null; | ||
return __assign({}, navigationItem, { dedicatedUrls: dedicatedUrls }); | ||
}); | ||
urlMappings.push(new UrlMapping_1.UrlMapping('SUMMARY.md', { navigation: navigation }, 'summary.hbs')); | ||
const navigationChildren = this.getNavigation(project).children; | ||
if (navigationChildren) { | ||
const navigation = navigationChildren.map(navigationItem => { | ||
const dedicatedUrls = navigationItem.dedicatedUrls | ||
? navigationItem.dedicatedUrls.map(url => { | ||
return { | ||
title: () => { | ||
const urlMapping = urlMappings.find(item => { | ||
return item.url === url; | ||
}); | ||
return urlMapping ? urlMapping.model.name : null; | ||
}, | ||
url, | ||
}; | ||
}) | ||
: null; | ||
return Object.assign({}, navigationItem, { dedicatedUrls }); | ||
}); | ||
urlMappings.push(new UrlMapping_1.UrlMapping('SUMMARY.md', { navigation }, 'summary.hbs')); | ||
} | ||
} | ||
return urlMappings; | ||
}; | ||
return MarkdownTheme; | ||
}(DefaultTheme_1.DefaultTheme)); | ||
} | ||
} | ||
exports.MarkdownTheme = MarkdownTheme; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var props = new Map(); | ||
const props = new Map(); | ||
function setProps(options, resources) { | ||
@@ -5,0 +5,0 @@ props.set('options', options); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var props_1 = require("./props"); | ||
const props_1 = require("./props"); | ||
function getMarkdownEngine() { | ||
var options = props_1.getOptions(); | ||
var specifiedEngine = options.mdEngine || options.mdFlavour || 'github'; | ||
const options = props_1.getOptions(); | ||
const specifiedEngine = options.mdEngine || options.mdFlavour || 'github'; | ||
return specifiedEngine; | ||
@@ -11,3 +11,3 @@ } | ||
function compilePartial(partialName, data) { | ||
var template = props_1.getResources() | ||
const template = props_1.getResources() | ||
.partials.getResource(partialName) | ||
@@ -19,3 +19,3 @@ .getTemplate(); | ||
function compileTemplate(templateName, data) { | ||
var template = props_1.getResources() | ||
const template = props_1.getResources() | ||
.templates.getResource(templateName) | ||
@@ -22,0 +22,0 @@ .getTemplate(); |
{ | ||
"name": "typedoc-plugin-markdown", | ||
"version": "1.1.20", | ||
"version": "1.1.21", | ||
"description": "A plugin for TypeDoc that exposes a theme and additional arguments for rendering markdown.", | ||
@@ -38,12 +38,12 @@ "main": "dist/index.js", | ||
"peerDependencies": { | ||
"typedoc": ">=0.9.0" | ||
"typedoc": ">=0.10.0" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^23.3.9", | ||
"@types/jest": "^23.3.11", | ||
"copyfiles": "^2.1.0", | ||
"jest": "^23.6.0", | ||
"ts-jest": "^23.10.4", | ||
"tslint": "^5.11.0", | ||
"typedoc": "^0.13.0", | ||
"typescript": "3.1.x" | ||
"ts-jest": "^23.10.5", | ||
"tslint": "^5.12.0", | ||
"typedoc": "^0.14.0", | ||
"typescript": "3.2.x" | ||
}, | ||
@@ -50,0 +50,0 @@ "dependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36243
550