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

typedoc-plugin-markdown

Package Overview
Dependencies
Maintainers
1
Versions
258
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

to
4.0.0-next.7

dist/partials/member.declaration.identifier.d.ts

38

dist/index.js

@@ -50,4 +50,4 @@ "use strict";

app.options.addDeclaration({
name: 'reflectionsWithOwnFile',
help: "[Markdown Plugin] Specifies which reflections are contained in their own file. Values 'none', 'all' OR Array of ['class', 'interface', 'enum', 'function', 'variable', 'type']",
name: 'kindsWithOwnFile',
help: "[Markdown Plugin] Specifies which reflection kinds are contained in their own file. Values 'none', 'all' OR Array of ['class', 'interface', 'enum', 'function', 'variable', 'type']",
type: typedoc_1.ParameterType.String | typedoc_1.ParameterType.Array,

@@ -57,2 +57,8 @@ defaultValue: 'all',

app.options.addDeclaration({
name: 'groupByKinds',
help: '[Markdown Plugin] Groups reflection kinds by headings if applicable e.g Classes, Functions. If set to false all symbols will render on the same level. Defaults to `true`',
type: typedoc_1.ParameterType.Boolean,
defaultValue: true,
});
app.options.addDeclaration({
name: 'hidePageTitle',

@@ -82,4 +88,4 @@ help: '[Markdown Plugin] Do not print page title.',

app.options.addDeclaration({
name: 'longTitles',
help: '[Markdown Plugin] Display full name including module paths in page titles.',
name: 'indentifiersAsCodeBlocks',
help: '[Markdown Plugin] Format signature and declaration identifiers in code blocks.',
type: typedoc_1.ParameterType.Boolean,

@@ -89,18 +95,18 @@ defaultValue: false,

app.options.addDeclaration({
name: 'groupByReflections',
help: '[Markdown Plugin] Groups reflections by headings if applicable e.g Classes, Functions. If set to false all symbols will render on the same level. Defaults to `true`',
type: typedoc_1.ParameterType.Boolean,
defaultValue: true,
name: 'propertiesFormat',
help: '[Markdown Plugin] Specify the render style of properties.',
type: typedoc_1.ParameterType.String,
defaultValue: 'List',
});
app.options.addDeclaration({
name: 'typeDeclarationStyle',
name: 'enumMembersFormat',
help: '[Markdown Plugin] Specify the render style of properties.',
type: typedoc_1.ParameterType.String,
defaultValue: 'List',
});
app.options.addDeclaration({
name: 'typeDeclarationFormat',
help: '[Markdown Plugin] Specify the render style of type declarations.',
type: typedoc_1.ParameterType.String,
defaultValue: 'table',
validate: (option) => {
const availableValues = ['table', 'list'];
if (!availableValues.includes(option)) {
throw new Error(`Unexpected value for typeDeclarationStyle, the expected value is one of 'table', 'list'`);
}
},
defaultValue: 'List',
});

@@ -107,0 +113,0 @@ app.options.addDeclaration({

@@ -6,2 +6,8 @@ import { ReflectionKind, TypeDocOptionMap } from 'typedoc';

entryDocument: string;
enumMembersFormat: 'List' | 'Table';
flattenOutputFiles: boolean;
frontmatterTags: string[];
frontmatterGlobals: FrontmatterGlobals;
frontmatterNamingConvention: FrontmatterNamingConvention;
groupByKinds: boolean;
hideBreadcrumbs: boolean;

@@ -11,12 +17,7 @@ hideInPageTOC: boolean;

hideHierarchy: boolean;
indexTitle: string;
flattenOutputFiles: boolean;
frontmatterTags: string[];
frontmatterGlobals: FrontmatterGlobals;
frontmatterNamingConvention: FrontmatterNamingConvention;
groupByReflections: boolean;
longTitles: boolean;
indentifiersAsCodeBlocks: boolean;
kindsWithOwnFile: string | string[];
namedAnchors: boolean;
reflectionsWithOwnFile: string | string[];
typeDeclarationStyle: 'list' | 'table';
propertiesFormat: 'List' | 'Table';
typeDeclarationFormat: 'List' | 'Table';
}

@@ -23,0 +24,0 @@ export interface TemplateMapping {

@@ -20,3 +20,3 @@ "use strict";

return {
[toVariable('title', context.getOption('frontmatterNamingConvention'))]: (0, utils_1.unEscapeChars)((0, helpers_1.getReflectionTitle)(page.model, context.getOption('longTitles'), true)),
[toVariable('title', context.getOption('frontmatterNamingConvention'))]: (0, utils_1.unEscapeChars)((0, helpers_1.getReflectionTitle)(page.model, true)),
};

@@ -23,0 +23,0 @@ }

import { DeclarationReflection } from 'typedoc';
import { MarkdownThemeRenderContext } from '../theme-context';
export declare function declarationMember(context: MarkdownThemeRenderContext, declaration: DeclarationReflection): string;
export declare function declarationMember(context: MarkdownThemeRenderContext, declaration: DeclarationReflection, parentHeadingLevel?: number): string;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.declarationMember = void 0;
const typedoc_1 = require("typedoc");
const els_1 = require("../support/els");
const helpers_1 = require("../support/helpers");
function declarationMember(context, declaration) {
var _a;
const utils_1 = require("../support/utils");
function declarationMember(context, declaration, parentHeadingLevel) {
const md = [];
const headingLevel = (0, helpers_1.getReflectionHeadingLevel)(declaration, context.getOption('groupByReflections')) + 1;
if (parentHeadingLevel) {
md.push(declarationBody(context, declaration, parentHeadingLevel));
}
else {
md.push(declarationBody(context, declaration));
}
return md.join('\n\n');
}
exports.declarationMember = declarationMember;
function declarationBody(context, declaration, parentHeadingLevel) {
var _a, _b, _c;
const md = [];
const headingLevel = (parentHeadingLevel
? parentHeadingLevel
: (0, helpers_1.getReflectionHeadingLevel)(declaration, context.getOption('groupByKinds'))) + 1;
const typeDeclaration = (_a = declaration.type) === null || _a === void 0 ? void 0 : _a.declaration;
if (declaration.type) {
md.push(`${context.partials.declarationMemberDefinition(declaration)}`);
const isTypeLiteralProperty = declaration.kindOf(typedoc_1.ReflectionKind.Property) &&
((_b = declaration.parent) === null || _b === void 0 ? void 0 : _b.kindOf(typedoc_1.ReflectionKind.TypeLiteral));
const titleSuffix = isTypeLiteralProperty
? ` - ${(0, utils_1.escapeChars)(declaration.name)}`
: '';
if (context.getOption('indentifiersAsCodeBlocks')) {
md.push((0, els_1.codeBlock)(context.partials.declarationMemberIdentifier(declaration)));
}
else {
md.push(`${!parentHeadingLevel ? '>' : ''} ${context.partials.declarationMemberIdentifier(declaration)}`);
}
if (declaration.comment) {

@@ -18,11 +41,11 @@ md.push(context.partials.comment(declaration.comment, headingLevel));

if (declaration.typeParameters) {
md.push((0, els_1.heading)(headingLevel, 'Type parameters'));
md.push(context.partials.typeParameters(declaration.typeParameters));
md.push((0, els_1.heading)(headingLevel, `Type parameters${titleSuffix}`));
md.push(context.partials.typeParametersTable(declaration.typeParameters));
}
if (typeDeclaration) {
if (typeDeclaration === null || typeDeclaration === void 0 ? void 0 : typeDeclaration.indexSignature) {
md.push((0, els_1.heading)(headingLevel, 'Index signature'));
md.push((0, els_1.heading)(headingLevel, `Index signature${titleSuffix}`));
md.push(context.partials.indexSignatureTitle(typeDeclaration.indexSignature));
}
md.push((0, els_1.heading)(headingLevel, 'Type declaration'));
md.push((0, els_1.heading)(headingLevel, `Type declaration${titleSuffix}`));
if (typeDeclaration === null || typeDeclaration === void 0 ? void 0 : typeDeclaration.signatures) {

@@ -33,14 +56,15 @@ typeDeclaration.signatures.forEach((signature) => {

}
if (typeDeclaration === null || typeDeclaration === void 0 ? void 0 : typeDeclaration.children) {
if (context.getOption('typeDeclarationStyle') === 'table') {
md.push(context.partials.typeDeclarationTable(typeDeclaration.children));
if ((_c = typeDeclaration === null || typeDeclaration === void 0 ? void 0 : typeDeclaration.children) === null || _c === void 0 ? void 0 : _c.length) {
if (context.getOption('typeDeclarationFormat').toLowerCase() === 'table') {
md.push(context.partials.propertiesTable(typeDeclaration.children));
}
else {
md.push(context.partials.typeDeclarationList(typeDeclaration.children));
md.push((0, els_1.blockQuoteBlock)(context.partials.typeDeclarationMember(typeDeclaration.children, headingLevel)));
}
}
}
md.push(context.partials.sources(declaration, headingLevel));
if (!parentHeadingLevel) {
md.push(context.partials.sources(declaration, headingLevel));
}
return md.join('\n\n');
}
exports.declarationMember = declarationMember;

@@ -9,3 +9,3 @@ "use strict";

const md = [];
const headingLevel = (0, helpers_1.getReflectionHeadingLevel)(reflection, context.getOption('groupByReflections'));
const headingLevel = (0, helpers_1.getReflectionHeadingLevel)(reflection, context.getOption('groupByKinds'));
if (context.getOption('namedAnchors')) {

@@ -31,10 +31,2 @@ md.push(`<a id="${reflection.anchor}" name="${reflection.anchor}"></a>`);

else {
if (reflection.hasGetterOrSetter()) {
if (reflection.getSignature) {
md.push(context.partials.signatureMember(reflection.getSignature));
}
if (reflection.setSignature) {
md.push(context.partials.signatureMember(reflection.setSignature));
}
}
if (reflection instanceof typedoc_1.ReferenceReflection) {

@@ -41,0 +33,0 @@ md.push(context.partials.referenceMember(reflection));

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.reflectionMember = void 0;
const typedoc_1 = require("typedoc");
const els_1 = require("../support/els");

@@ -9,3 +10,4 @@ const helpers_1 = require("../support/helpers");

const md = [];
const headingLevel = (0, helpers_1.getReflectionHeadingLevel)(reflection, context.getOption('groupByReflections')) + 1;
const headingLevel = (0, helpers_1.getReflectionHeadingLevel)(reflection, context.getOption('groupByKinds')) +
1;
if (reflection.comment) {

@@ -16,3 +18,3 @@ md.push(context.partials.comment(reflection.comment, headingLevel));

md.push((0, els_1.heading)(headingLevel, 'Type parameters'));
md.push(context.partials.typeParameters(reflection.typeParameters));
md.push(context.partials.typeParametersTable(reflection.typeParameters));
}

@@ -36,3 +38,5 @@ if (!context.getOption('hideHierarchy') && ((_a = reflection.typeHierarchy) === null || _a === void 0 ? void 0 : _a.next)) {

}
md.push(context.partials.toc(reflection));
if (reflection.kindOf([typedoc_1.ReflectionKind.Module, typedoc_1.ReflectionKind.Namespace])) {
md.push(context.partials.toc(reflection));
}
md.push(context.partials.members(reflection));

@@ -39,0 +43,0 @@ return md.join('\n\n');

@@ -22,11 +22,16 @@ "use strict";

? parentHeadingLevel
: (0, helpers_1.getReflectionHeadingLevel)(signature.parent, context.getOption('groupByReflections'))) + 1;
: (0, helpers_1.getReflectionHeadingLevel)(signature.parent, context.getOption('groupByKinds'))) + 1;
if (signature.comment) {
md.push(context.partials.comment(signature.comment, headingLevel));
}
md.push(`> ${context.partials.signatureMemberDefinition(signature)}`);
if (context.getOption('indentifiersAsCodeBlocks')) {
md.push((0, els_1.codeBlock)(context.partials.signatureMemberIdentifier(signature)));
}
else {
md.push(`> ${context.partials.signatureMemberIdentifier(signature)}`);
}
const typeDeclaration = (_a = signature.type) === null || _a === void 0 ? void 0 : _a.declaration;
if ((_b = signature.typeParameters) === null || _b === void 0 ? void 0 : _b.length) {
md.push((0, els_1.heading)(headingLevel, 'Type parameters'));
md.push(context.partials.typeParameters(signature.typeParameters));
md.push(context.partials.typeParametersTable(signature.typeParameters));
}

@@ -52,7 +57,7 @@ if ((_c = signature.parameters) === null || _c === void 0 ? void 0 : _c.length) {

if (typeDeclaration === null || typeDeclaration === void 0 ? void 0 : typeDeclaration.children) {
if (context.getOption('typeDeclarationStyle') === 'table') {
md.push(context.partials.typeDeclarationTable(typeDeclaration.children));
if (context.getOption('typeDeclarationFormat').toLowerCase() === 'table') {
md.push(context.partials.propertiesTable(typeDeclaration.children));
}
else {
md.push(context.partials.typeDeclarationList(typeDeclaration.children));
md.push(context.partials.typeDeclarationMember(typeDeclaration.children, headingLevel));
}

@@ -59,0 +64,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.members = void 0;
const typedoc_1 = require("typedoc");
const constants_1 = require("../support/constants");

@@ -21,3 +22,3 @@ const els_1 = require("../support/els");

(_a = container.groups) === null || _a === void 0 ? void 0 : _a.filter((group) => !group.allChildrenHaveOwnDocument()).forEach((group) => {
const headingLevel = (0, helpers_1.getGroupHeadingLevel)(container, context.getOption('groupByReflections'));
const headingLevel = (0, helpers_1.getGroupHeadingLevel)(container, context.getOption('groupByKinds'));
if (group.categories) {

@@ -30,14 +31,26 @@ md.push((0, els_1.heading)(headingLevel, group.title));

else {
if (context.getOption('groupByReflections') ||
if (context.getOption('groupByKinds') ||
constants_1.SYMBOLS_WITH_DOCUMENTS.includes(container.kind)) {
md.push((0, els_1.heading)(headingLevel, group.title));
}
group.children
.filter((item) => !item.hasOwnDocument)
.forEach((groupChild) => {
md.push(context.partials.member(groupChild));
if (constants_1.SYMBOLS_WITH_DOCUMENTS.includes(groupChild.kind)) {
md.push((0, els_1.horizontalRule)());
}
});
const isPropertiesGroup = group.children.every((child) => child.kindOf(typedoc_1.ReflectionKind.Property));
const isEnumGroup = group.children.every((child) => child.kindOf(typedoc_1.ReflectionKind.EnumMember));
if (isPropertiesGroup &&
context.getOption('propertiesFormat').toLowerCase() === 'table') {
md.push(context.partials.propertiesTable(group.children));
}
else if (isEnumGroup &&
context.getOption('enumMembersFormat').toLowerCase() === 'table') {
md.push(context.partials.enumMembersTable(group.children));
}
else {
group.children
.filter((item) => !item.hasOwnDocument)
.forEach((groupChild) => {
md.push(context.partials.member(groupChild));
if (constants_1.SYMBOLS_WITH_DOCUMENTS.includes(groupChild.kind)) {
md.push((0, els_1.horizontalRule)());
}
});
}
}

@@ -44,0 +57,0 @@ });

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.pageTitle = void 0;
const typedoc_1 = require("typedoc");
const els_1 = require("../support/els");

@@ -8,5 +9,9 @@ const helpers_1 = require("../support/helpers");

const md = [];
md.push((0, els_1.heading)(1, (0, helpers_1.getReflectionTitle)(page.model, context.getOption('longTitles'), true)));
const title = [(0, helpers_1.getReflectionTitle)(page.model, true)];
if (!page.model.kindOf(typedoc_1.ReflectionKind.Module)) {
title.unshift(typedoc_1.ReflectionKind.singularString(page.model.kind));
}
md.push((0, els_1.heading)(1, title.join(': ')));
return md.join('\n\n');
}
exports.pageTitle = pageTitle;

@@ -5,2 +5,4 @@ "use strict";

const typedoc_1 = require("typedoc");
const els_1 = require("../support/els");
const helpers_1 = require("../support/helpers");
const utils_1 = require("../support/utils");

@@ -26,6 +28,2 @@ function parametersTable(context, parameters) {

};
return table(context, parameters.reduce((acc, current) => parseParams(current, acc), []));
}
exports.parametersTable = parametersTable;
function table(context, parameters) {
const showDefaults = hasDefaultValues(parameters);

@@ -42,3 +40,4 @@ const comments = parameters.map((param) => { var _a; return !!((_a = param.comment) === null || _a === void 0 ? void 0 : _a.hasVisibleComponent()); });

const firstOptionalParamIndex = parameters.findIndex((parameter) => parameter.flags.isOptional);
const rows = parameters.map((parameter, i) => {
const rows = [];
parameters.forEach((parameter, i) => {
const row = [];

@@ -49,13 +48,3 @@ const isOptional = parameter.flags.isOptional ||

const optional = isOptional ? '?' : '';
const isDestructuredParam = parameter.name == '__namedParameters';
const isDestructuredParamProp = parameter.name.startsWith('__namedParameters.');
if (isDestructuredParam) {
row.push(`\`${rest}«destructured»\``);
}
else if (isDestructuredParamProp) {
row.push(`› \`${rest}${parameter.name.slice(18)}${optional}\``);
}
else {
row.push(`\`${rest}${parameter.name}${optional}\``);
}
row.push(`${rest}${(0, utils_1.escapeChars)(parameter.name)}${optional}`);
if (parameter.type) {

@@ -69,3 +58,3 @@ row.push((0, utils_1.stripLineBreaks)(context.partials.someType(parameter.type, 'object')));

if (parameter.comment) {
row.push((0, utils_1.stripLineBreaks)(context.partials.comment(parameter.comment)).replace(/\|/g, '\\|'));
row.push((0, helpers_1.tableComments)(context.partials.comment(parameter.comment)));
}

@@ -76,13 +65,11 @@ else {

}
return `| ${row.join(' | ')} |\n`;
rows.push(row);
});
const output = `\n| ${headers.join(' | ')} |\n| ${headers
.map(() => ':------')
.join(' | ')} |\n${rows.join('')}`;
return output;
return (0, els_1.table)(headers, rows);
}
exports.parametersTable = parametersTable;
function getDefaultValue(parameter) {
return parameter.defaultValue && parameter.defaultValue !== '...'
? `\`${parameter.defaultValue}\``
: '`undefined`';
? (0, utils_1.escapeChars)(parameter.defaultValue)
: 'undefined';
}

@@ -89,0 +76,0 @@ function hasDefaultValues(parameters) {

@@ -18,3 +18,3 @@ "use strict";

(isVisible && reflection.groups)) {
const headingLevel = (0, helpers_1.getIndexHeadingLevel)(reflection, context.getOption('groupByReflections'));
const headingLevel = (0, helpers_1.getIndexHeadingLevel)(reflection, context.getOption('groupByKinds'));
const subHeadingLevel = headingLevel + 1;

@@ -21,0 +21,0 @@ md.push((0, els_1.heading)(headingLevel, 'Index') + '\n\n');

@@ -22,3 +22,3 @@ "use strict";

declarationReflection.children.map((obj) => {
return `${context.partials.propertyName(obj)}: ${context.partials.someType((0, helpers_1.getPropertyType)(obj))};`;
return `${context.partials.declarationMemberName(obj, false)}: ${context.partials.someType((0, helpers_1.getDeclarationType)(obj))};`;
});

@@ -25,0 +25,0 @@ if (indexSignature) {

@@ -5,2 +5,3 @@ "use strict";

const typedoc_1 = require("typedoc");
const els_1 = require("../support/els");
const utils_1 = require("../support/utils");

@@ -50,4 +51,7 @@ function someType(context, someType, collapse = 'none') {

}
return '' + (0, utils_1.escapeChars)(someType === null || someType === void 0 ? void 0 : someType.toString());
if (someType.toString() == 'null') {
return (0, els_1.backTicks)('null');
}
return (0, utils_1.escapeChars)(someType === null || someType === void 0 ? void 0 : someType.toString());
}
exports.someType = someType;

@@ -16,18 +16,19 @@ import { ArrayType, ConditionalType, ContainerReflection, Comment, CommentDisplayPart, DeclarationHierarchy, DeclarationReflection, InferredType, IntersectionType, IntrinsicType, IndexedAccessType, LiteralType, PageEvent, ParameterReflection, ProjectReflection, QueryType, ReferenceReflection, ReferenceType, ReflectionType, SignatureReflection, SomeType, TupleType, TypeOperatorType, TypeParameterReflection, UnionType, UnknownType } from 'typedoc';

hierarchy: (declarationHierarchy: DeclarationHierarchy) => string;
declarationMemberDefinition: (reflection: DeclarationReflection) => string;
declarationMember: (declaration: DeclarationReflection) => string;
declarationMemberIdentifier: (reflection: DeclarationReflection) => string;
declarationMemberName: (declaration: DeclarationReflection, emphasis?: boolean) => string;
declarationMember: (declaration: DeclarationReflection, parentHeadingLevel?: number | undefined) => string;
indexSignatureTitle: (signature: SignatureReflection) => string;
referenceMember: (props: ReferenceReflection) => string;
reflectionMember: (reflection: DeclarationReflection) => string;
signatureMemberDefinition: (signature: SignatureReflection, accessor?: string | undefined) => string;
signatureMemberIdentifier: (signature: SignatureReflection) => string;
signatureMember: (signature: SignatureReflection, parentHeadingLevel?: number | undefined) => string;
sources: (reflection: DeclarationReflection | SignatureReflection, headingLevel: number) => string;
member: (reflection: DeclarationReflection) => string;
typeDeclarationList: (props: DeclarationReflection[]) => string;
typeDeclarationTable: (props: DeclarationReflection[]) => string;
typeParameters: (typeParameters: TypeParameterReflection[]) => string;
typeDeclarationMember: (declarations: DeclarationReflection[], parentHeadingLevel: number) => string;
members: (container: ContainerReflection) => string;
pageTitle: (page: PageEvent<DeclarationReflection>) => string;
propertyName: (property: DeclarationReflection) => string;
sources: (reflection: DeclarationReflection | SignatureReflection, headingLevel: number) => string;
enumMembersTable: (props: DeclarationReflection[]) => string;
parametersTable: (parameters: ParameterReflection[]) => string;
propertiesTable: (props: DeclarationReflection[]) => string;
typeParametersTable: (typeParameters: TypeParameterReflection[]) => string;
toc: (reflection: DeclarationReflection | ProjectReflection) => string;

@@ -34,0 +35,0 @@ arrayType: (arrayType: ArrayType) => string;

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

const hierarchy_1 = require("./partials/hierarchy");
const member_declaration_definition_1 = require("./partials/member.declaration.definition");
const member_declaration_identifier_1 = require("./partials/member.declaration.identifier");
const member_declaration_name_1 = require("./partials/member.declaration.name");
const member_declaration_1 = require("./partials/member.declaration");

@@ -19,13 +20,13 @@ const member_indexsignature_title_1 = require("./partials/member.indexsignature.title");

const member_reflection_1 = require("./partials/member.reflection");
const member_signature_definition_1 = require("./partials/member.signature.definition");
const member_signature_identifier_1 = require("./partials/member.signature.identifier");
const member_signature_1 = require("./partials/member.signature");
const member_sources_1 = require("./partials/member.sources");
const member_2 = require("./partials/member");
const member_typedeclaration_list_1 = require("./partials/member.typedeclaration.list");
const member_typedeclaration_table_1 = require("./partials/member.typedeclaration.table");
const member_typeparameters_1 = require("./partials/member.typeparameters");
const member_typedeclaration_1 = require("./partials/member.typedeclaration");
const members_1 = require("./partials/members");
const page_title_1 = require("./partials/page.title");
const property_name_1 = require("./partials/property.name");
const sources_1 = require("./partials/sources");
const table_enum_members_1 = require("./partials/table.enum-members");
const table_parameters_1 = require("./partials/table.parameters");
const table_properties_1 = require("./partials/table.properties");
const table_typeparameters_1 = require("./partials/table.typeparameters");
const toc_1 = require("./partials/toc");

@@ -65,3 +66,4 @@ const type_array_1 = require("./partials/type.array");

hierarchy: bind(hierarchy_1.hierarchy, context),
declarationMemberDefinition: bind(member_declaration_definition_1.declarationMemberDefinition, context),
declarationMemberIdentifier: bind(member_declaration_identifier_1.declarationMemberIdentifier, context),
declarationMemberName: bind(member_declaration_name_1.declarationMemberName, context),
declarationMember: bind(member_declaration_1.declarationMember, context),

@@ -71,13 +73,13 @@ indexSignatureTitle: bind(member_indexsignature_title_1.indexSignatureTitle, context),

reflectionMember: bind(member_reflection_1.reflectionMember, context),
signatureMemberDefinition: bind(member_signature_definition_1.signatureMemberDefinition, context),
signatureMemberIdentifier: bind(member_signature_identifier_1.signatureMemberIdentifier, context),
signatureMember: bind(member_signature_1.signatureMember, context),
sources: bind(member_sources_1.sources, context),
member: bind(member_2.member, context),
typeDeclarationList: bind(member_typedeclaration_list_1.typeDeclarationList, context),
typeDeclarationTable: bind(member_typedeclaration_table_1.typeDeclarationTable, context),
typeParameters: bind(member_typeparameters_1.typeParameters, context),
typeDeclarationMember: bind(member_typedeclaration_1.typeDeclarationMember, context),
members: bind(members_1.members, context),
pageTitle: bind(page_title_1.pageTitle, context),
propertyName: bind(property_name_1.propertyName, context),
sources: bind(sources_1.sources, context),
enumMembersTable: bind(table_enum_members_1.enumMembersTable, context),
parametersTable: bind(table_parameters_1.parametersTable, context),
propertiesTable: bind(table_properties_1.propertiesTable, context),
typeParametersTable: bind(table_typeparameters_1.typeParametersTable, context),
toc: bind(toc_1.toc, context),

@@ -84,0 +86,0 @@ arrayType: bind(type_array_1.arrayType, context),

@@ -23,7 +23,9 @@ "use strict";

.map(() => ':------')
.join(' | ')} |\n${rows.map((row) => `| ${row.join(' | ')} \n`).join('')}`;
.join(' | ')} |\n${rows.map((row) => `| ${row.join(' | ')} |\n`).join('')}`;
exports.table = table;
const blockQuoteBlock = (content) => {
const lines = content.split('\n');
return lines.map((line) => (line.length ? `> ${line}` : '>')).join('\n');
return lines
.map((line) => (line.length ? `> ${line.trim()}` : '>'))
.join('\n');
};

@@ -30,0 +32,0 @@ exports.blockQuoteBlock = blockQuoteBlock;

import { CommentTag, ContainerReflection, DeclarationReflection, ProjectReflection, SignatureReflection } from 'typedoc';
export declare function getIndexHeadingLevel(reflection: DeclarationReflection | ProjectReflection, groupByReflections: boolean): 2 | 3 | 4;
export declare function getGroupHeadingLevel(container: ContainerReflection, groupByReflections: boolean): 2 | 3 | 4;
export declare function getReflectionHeadingLevel(reflection: DeclarationReflection | SignatureReflection, groupByReflections: boolean): 1 | 2 | 3 | 4 | 5;
export declare function getReflectionTitle(reflection: DeclarationReflection, fullname?: boolean, typeParams?: boolean): string;
export declare function getIndexHeadingLevel(reflection: DeclarationReflection | ProjectReflection, groupByKinds: boolean): 2 | 3 | 4;
export declare function getGroupHeadingLevel(container: ContainerReflection, groupByKinds: boolean): 2 | 3 | 4;
export declare function getReflectionHeadingLevel(reflection: DeclarationReflection | SignatureReflection, groupByKinds: boolean): 1 | 2 | 3 | 4 | 5;
export declare function getReflectionTitle(reflection: DeclarationReflection, typeParams?: boolean): string;
export declare function getTypeParameters(reflection: DeclarationReflection): string;
export declare function getFlags(reflection: DeclarationReflection): string | null;
export declare function tableComments(str: string): string;
export declare function getTagName(tag: CommentTag): string;
export declare function getPropertyType(property: any): any;
export declare function getDeclarationType(declaration: DeclarationReflection): import("typedoc").SomeType | undefined;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getPropertyType = exports.getTagName = exports.getFlags = exports.getTypeParameters = exports.getReflectionTitle = exports.getReflectionHeadingLevel = exports.getGroupHeadingLevel = exports.getIndexHeadingLevel = void 0;
exports.getDeclarationType = exports.getTagName = exports.tableComments = exports.getFlags = exports.getTypeParameters = exports.getReflectionTitle = exports.getReflectionHeadingLevel = exports.getGroupHeadingLevel = exports.getIndexHeadingLevel = void 0;
const typedoc_1 = require("typedoc");
const els_1 = require("./els");
const utils_1 = require("./utils");
function getIndexHeadingLevel(reflection, groupByReflections) {
function getIndexHeadingLevel(reflection, groupByKinds) {
if (reflection.kindOf([

@@ -16,13 +16,13 @@ typedoc_1.ReflectionKind.Project,

}
return groupByReflections ? 4 : 3;
return groupByKinds ? 4 : 3;
}
exports.getIndexHeadingLevel = getIndexHeadingLevel;
function getGroupHeadingLevel(container, groupByReflections) {
function getGroupHeadingLevel(container, groupByKinds) {
if (container.kindOf(typedoc_1.ReflectionKind.Project)) {
return 2;
}
return container.hasOwnDocument ? 2 : groupByReflections ? 4 : 3;
return container.hasOwnDocument ? 2 : groupByKinds ? 4 : 3;
}
exports.getGroupHeadingLevel = getGroupHeadingLevel;
function getReflectionHeadingLevel(reflection, groupByReflections) {
function getReflectionHeadingLevel(reflection, groupByKinds) {
var _a, _b, _c, _d;

@@ -33,3 +33,3 @@ if (reflection.hasOwnDocument) {

if ((_a = reflection === null || reflection === void 0 ? void 0 : reflection.parent) === null || _a === void 0 ? void 0 : _a.kindOf(typedoc_1.ReflectionKind.Project)) {
return groupByReflections ? 3 : 2;
return groupByKinds ? 3 : 2;
}

@@ -39,3 +39,3 @@ if (reflection.kindOf(typedoc_1.ReflectionKind.Constructor)) {

}
if (groupByReflections) {
if (groupByKinds) {
return ((_c = reflection.parent) === null || _c === void 0 ? void 0 : _c.hasOwnDocument) ? 3 : 5;

@@ -46,13 +46,8 @@ }

exports.getReflectionHeadingLevel = getReflectionHeadingLevel;
function getReflectionTitle(reflection, fullname = false, typeParams = false) {
var _a, _b;
const md = [
(0, utils_1.escapeChars)(fullname ? reflection.getFullName() : reflection.name),
];
function getReflectionTitle(reflection, typeParams = false) {
var _a;
const md = [(0, utils_1.escapeChars)(reflection.name)];
if ((_a = reflection.signatures) === null || _a === void 0 ? void 0 : _a.length) {
md.push('()');
}
if ((_b = reflection.flags) === null || _b === void 0 ? void 0 : _b.isOptional) {
md.push('?');
}
if (typeParams) {

@@ -82,2 +77,6 @@ md.push(getTypeParameters(reflection));

exports.getFlags = getFlags;
function tableComments(str) {
return (0, utils_1.stripLineBreaks)(str).replace(/\|/g, '\\|');
}
exports.tableComments = tableComments;
function getTagName(tag) {

@@ -87,11 +86,11 @@ return tag.tag.substring(1);

exports.getTagName = getTagName;
function getPropertyType(property) {
if (property.getSignature) {
return property.getSignature.type;
function getDeclarationType(declaration) {
if (declaration.getSignature) {
return declaration.getSignature.type;
}
if (property.setSignature) {
return property.setSignature.type;
if (declaration.setSignature) {
return declaration.setSignature.type;
}
return property.type ? property.type : property;
return declaration.type;
}
exports.getPropertyType = getPropertyType;
exports.getDeclarationType = getDeclarationType;
import { ReflectionKind } from 'typedoc';
export declare function escapeChars(str: string): string;
export declare function escapeTableCol(str: string): string;
export declare function unEscapeChars(str: string): string;

@@ -4,0 +5,0 @@ export declare function stripComments(str: string): string;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.slugify = exports.getKindString = exports.getKindPlural = exports.camelToTitleCase = exports.stripLineBreaks = exports.stripComments = exports.unEscapeChars = exports.escapeChars = void 0;
exports.slugify = exports.getKindString = exports.getKindPlural = exports.camelToTitleCase = exports.stripLineBreaks = exports.stripComments = exports.unEscapeChars = exports.escapeTableCol = exports.escapeChars = void 0;
const typedoc_1 = require("typedoc");

@@ -16,2 +16,6 @@ const constants_1 = require("./constants");

exports.escapeChars = escapeChars;
function escapeTableCol(str) {
return str.replace(/(?<!\\)\|/g, '\\|');
}
exports.escapeTableCol = escapeTableCol;
function unEscapeChars(str) {

@@ -18,0 +22,0 @@ return str

@@ -8,6 +8,6 @@ import { DeclarationReflection, PageEvent, ProjectReflection, Reflection, RenderTemplate, Renderer, Theme, UrlMapping } from 'typedoc';

flattenOutputFiles: string;
groupByReflections: string[];
groupByKinds: string[];
kindsWithOwnFile: string | string[];
preserveAnchorCasing: boolean;
readme: string;
reflectionsWithOwnFile: string | string[];
private _renderContext?;

@@ -14,0 +14,0 @@ private anchors;

@@ -36,2 +36,3 @@ "use strict";

const constants_1 = require("./support/constants");
const utils_1 = require("./support/utils");
const theme_context_1 = require("./theme-context");

@@ -115,3 +116,3 @@ class MarkdownTheme extends typedoc_1.Theme {

const parts = alias.split('.');
const includesNamespace = (_a = reflection.children) === null || _a === void 0 ? void 0 : _a.some((child) => child.kindOf(typedoc_1.ReflectionKind.Namespace));
const childrenIncludeNamespaces = (_a = reflection.children) === null || _a === void 0 ? void 0 : _a.some((child) => child.kindOf(typedoc_1.ReflectionKind.Namespace));
const isModuleOrNamespace = reflection.kindOf([

@@ -122,7 +123,8 @@ typedoc_1.ReflectionKind.Module,

const namespaces = this.getNamespaces(reflection);
if (mapping.directory && !isModuleOrNamespace && this.groupByReflections) {
if (mapping.directory && !isModuleOrNamespace && this.groupByKinds) {
parts.splice(parts.length - 1, 0, mapping.directory);
}
if ((this.reflectionsWithOwnFile[0] !== 'none' && isModuleOrNamespace) ||
includesNamespace) {
if ((this.kindsWithOwnFile[0].toLocaleLowerCase() !== 'none' &&
isModuleOrNamespace) ||
childrenIncludeNamespaces) {
parts.push(parts[parts.length - 1]);

@@ -133,5 +135,3 @@ }

const namespaceIndex = parts.findIndex((part) => part === namespaceName);
if (namespaceIndex > 0) {
parts.splice(namespaceIndex, 0, this.mappings[typedoc_1.ReflectionKind.Namespace].directory);
}
parts.splice(namespaceIndex, 0, this.mappings[typedoc_1.ReflectionKind.Namespace].directory);
});

@@ -142,3 +142,3 @@ if (reflection.kindOf(typedoc_1.ReflectionKind.Namespace))

if (!isModuleOrNamespace) {
parts[parts.length - 1] = `${typedoc_1.ReflectionKind.singularString(reflection.kind).toLowerCase()}.${parts[parts.length - 1]}`;
parts[parts.length - 1] = `${(0, utils_1.slugify)(typedoc_1.ReflectionKind.singularString(reflection.kind))}.${parts[parts.length - 1]}`;
}

@@ -161,14 +161,16 @@ return parts.join(this.flattenOutputFiles ? '.' : '/') + '.md';

(!reflection.url || !constants_1.URL_PREFIX.test(reflection.url))) {
const reflectionId = this.preserveAnchorCasing
? reflection.name
: reflection.name.toLowerCase();
if (isSymbol) {
this.anchors[container.url]
? this.anchors[container.url].push(reflectionId)
: (this.anchors[container.url] = [reflectionId]);
if (!reflection.kindOf(typedoc_1.ReflectionKind.TypeLiteral)) {
const reflectionId = this.preserveAnchorCasing
? reflection.name
: reflection.name.toLowerCase();
if (isSymbol) {
this.anchors[container.url]
? this.anchors[container.url].push(reflectionId)
: (this.anchors[container.url] = [reflectionId]);
}
const count = (_b = (_a = this.anchors[container.url]) === null || _a === void 0 ? void 0 : _a.filter((id) => id === reflectionId)) === null || _b === void 0 ? void 0 : _b.length;
const anchor = reflectionId + (count > 1 ? '-' + (count - 1).toString() : '');
reflection.url = container.url + '#' + anchor;
reflection.anchor = anchor;
}
const count = (_b = (_a = this.anchors[container.url]) === null || _a === void 0 ? void 0 : _a.filter((id) => id === reflectionId)) === null || _b === void 0 ? void 0 : _b.length;
const anchor = reflectionId + (count > 1 ? '-' + (count - 1).toString() : '');
reflection.url = container.url + '#' + anchor;
reflection.anchor = anchor;
reflection.hasOwnDocument = false;

@@ -183,3 +185,6 @@ }

get mappings() {
const isAll = this.reflectionsWithOwnFile.includes('all');
const kindsWithOwnFile = Array.isArray(this.kindsWithOwnFile)
? this.kindsWithOwnFile.map((val) => val.toLowerCase())
: [this.kindsWithOwnFile.toLowerCase()];
const isAll = kindsWithOwnFile.includes('all');
const mappings = {

@@ -199,3 +204,3 @@ [typedoc_1.ReflectionKind.Module]: {

};
if (isAll || this.reflectionsWithOwnFile.includes('class')) {
if (isAll || kindsWithOwnFile.includes('class')) {
mappings[typedoc_1.ReflectionKind.Class] = {

@@ -208,3 +213,3 @@ isLeaf: false,

}
if (isAll || this.reflectionsWithOwnFile.includes('interface')) {
if (isAll || kindsWithOwnFile.includes('interface')) {
mappings[typedoc_1.ReflectionKind.Interface] = {

@@ -217,3 +222,3 @@ isLeaf: false,

}
if (isAll || this.reflectionsWithOwnFile.includes('enum')) {
if (isAll || kindsWithOwnFile.includes('enum')) {
mappings[typedoc_1.ReflectionKind.Enum] = {

@@ -226,3 +231,3 @@ isLeaf: false,

}
if (isAll || this.reflectionsWithOwnFile.includes('function')) {
if (isAll || kindsWithOwnFile.includes('function')) {
mappings[typedoc_1.ReflectionKind.Function] = {

@@ -235,3 +240,3 @@ isLeaf: true,

}
if (isAll || this.reflectionsWithOwnFile.includes('type')) {
if (isAll || kindsWithOwnFile.includes('typealias')) {
mappings[typedoc_1.ReflectionKind.TypeAlias] = {

@@ -244,3 +249,3 @@ isLeaf: true,

}
if (isAll || this.reflectionsWithOwnFile.includes('var')) {
if (isAll || kindsWithOwnFile.includes('variable')) {
mappings[typedoc_1.ReflectionKind.Variable] = {

@@ -269,5 +274,8 @@ isLeaf: true,

__decorate([
(0, typedoc_1.BindOption)('groupByReflections')
], MarkdownTheme.prototype, "groupByReflections", void 0);
(0, typedoc_1.BindOption)('groupByKinds')
], MarkdownTheme.prototype, "groupByKinds", void 0);
__decorate([
(0, typedoc_1.BindOption)('kindsWithOwnFile')
], MarkdownTheme.prototype, "kindsWithOwnFile", void 0);
__decorate([
(0, typedoc_1.BindOption)('preserveAnchorCasing')

@@ -278,5 +286,2 @@ ], MarkdownTheme.prototype, "preserveAnchorCasing", void 0);

], MarkdownTheme.prototype, "readme", void 0);
__decorate([
(0, typedoc_1.BindOption)('reflectionsWithOwnFile')
], MarkdownTheme.prototype, "reflectionsWithOwnFile", void 0);
exports.MarkdownTheme = MarkdownTheme;
{
"name": "typedoc-plugin-markdown",
"version": "4.0.0-next.6",
"version": "4.0.0-next.7",
"description": "A plugin for TypeDoc that enables TypeScript API documentation to be generated in Markdown.",

@@ -16,7 +16,7 @@ "main": "dist/index.js",

"build": "rm -rf dist && tsc",
"test": "jest --colors",
"test": "jest --colors --updateSnapshot",
"build-and-test": "npm run build && npm run test",
"docs": "npm run build && npm-run-all docs:*",
"docs:md-1": "typedoc --plugin typedoc-plugin-markdown --enableFrontmatter --longTitles --options ../../stubs/typedoc.json --out ./out/md/md-1",
"docs:md-2": "typedoc --plugin typedoc-plugin-markdown --groupByReflections false --hideInPageTOC --typeDeclarationStyle \"list\" --readme \"none\" --reflectionsWithOwnFile none --options ../../stubs/typedoc.json --out ./out/md/md-2",
"docs:md-1": "typedoc --plugin typedoc-plugin-markdown --options ../../stubs/typedoc.json --enableFrontmatter --out ./out/md/md-1",
"docs:md-2": "typedoc --plugin typedoc-plugin-markdown --options ../../stubs/typedoc.json --indentifiersAsCodeBlocks --groupByKinds false --propertiesFormat \"table\" --typeDeclarationFormat \"table\" --enumMembersFormat \"table\" --readme \"none\" --kindsWithOwnFile \"none\" --out ./out/md/md-2",
"docs:html": "typedoc --options ../../stubs/typedoc.json --out ./out/html"

@@ -23,0 +23,0 @@ },

@@ -39,8 +39,6 @@ # typedoc-plugin-markdown

The file name of the entry document. Defaults to `README.md`.
- **`--reflectionsWithOwnFile`**<br>
Determines which reflections should be written to its own file. Expected values [`none`, `all`] OR Array of [`class`, `interface`, `enum`, `function`, `var`, `type`] Defaults to `all` (all reflections exported to an individual file).
- **`--groupByReflections`**<br>
Groups reflections by type (if applicable). If set to `false` all reflections will group at the same level. Note this effects directory stucture and UI organisation heading structure. Defaults to `true`.
- **`--kindsWithOwnFile`**<br>
Determines which reflection kinds should be written to its own file. Expected values [`None`, `All`] OR Array of [`Class`, `Interface`, `Enum`, `Function`, `Variable`, `TypeAlias`]. Defaults to `All`.
- **`--flattenOutputFiles`**<br>
Flatten output files without directories. Note this does not effect the UI.
Flatten output files without directories. Note this does not effect the UI. Defaults to `false`.

@@ -57,4 +55,12 @@ ### UI options

Do not print reflection hierarchy. Defaults to `false`.
- **`--enableLongTitles`**<br>
Display full name including module paths in page titles. Defaults to `false`.
- **`--groupByKinds`**<br>
Group reflection kinds by headings (if applicable). If set to `false` all reflections will group at the same level. Note this effects directory stucture and UI organisation heading structure. Defaults to `true`.
- **`--indentifiersAsCodeBlocks`**<br>
Format signature and declaration identifiers in code blocks. Note if `true` references will not be linked. Defaults to `false`.
- **`--propertiesFormat`**<br>
Specify the render style of properties groups for Interfaces and Classes. Expected values [`List`, `Table`]. Defaults to `List`.
- **`--typeDeclarationFormat`**<br>
Specify the render style of type declarations. Expected values [`List`, `Table`]. Defaults to `List`.
- **`--enumMembersFormat`**<br>
Specify the render style of Enum members. Expected values [`List`, `Table`]. Defaults to `List`.

@@ -61,0 +67,0 @@ ### Frontmatter options