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
252
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 4.4.0 to 4.4.1

dist/internationalization/setup.d.ts

7

dist/index.d.ts

@@ -11,9 +11,2 @@ import { Application } from 'typedoc';

*
* The load functions:
*
* 1. Bootstrap the plugin options
* 2. Configures markdown outputs
* 3. Configures localization
* 4. Applies any other behaviour
*
* The module also exports anything that is available publicly.

@@ -20,0 +13,0 @@ *

58

dist/index.js

@@ -6,8 +6,6 @@ /**

*/
import { getTranslatable } from './internationalization/translatable.js';
import { setupInternationalization } from './internationalization/index.js';
import { declarations } from './options/index.js';
import { resolvePackages } from './renderer/packages.js';
import { MarkdownTheme } from './public-api.js';
import { Converter, EventHooks, ParameterHint, ParameterType, } from 'typedoc';
import { render } from './renderer/render.js';
import { render, setupRenderer } from './renderer/index.js';
import { ParameterHint, ParameterType, } from 'typedoc';
/**

@@ -22,9 +20,2 @@ * The function that is called by TypeDoc to bootstrap the plugin.

*
* The load functions:
*
* 1. Bootstrap the plugin options
* 2. Configures markdown outputs
* 3. Configures localization
* 4. Applies any other behaviour
*
* The module also exports anything that is available publicly.

@@ -39,3 +30,2 @@ *

*/
// Iterate over declaration definitions and to the container.
Object.entries(declarations).forEach(([name, declaration]) => {

@@ -47,8 +37,2 @@ app.options.addDeclaration({

});
app.renderer.defineTheme('markdown', MarkdownTheme);
/**
* =============================
* 2. Configure markdown outputs
* =============================
*/
app.options.addDeclaration({

@@ -62,2 +46,7 @@ name: 'markdown',

});
/**
* =============================
* 2. Configure markdown outputs
* =============================
*/
app.outputs.addOutput('markdown', async (out, project) => {

@@ -67,30 +56,9 @@ await render(app.renderer, project, out);

app.outputs.setDefaultOutputName('markdown');
Object.defineProperty(app.renderer, 'markdownHooks', {
value: new EventHooks(),
});
/**
* =========================
* 3. Configure localization
* =========================
* =====================================
* 3. Setup up renderer and translations
* ======================================
*/
// Load the additional translations used by the theme for the selected language.
app.converter.on(Converter.EVENT_BEGIN, () => {
app.internationalization.addTranslations(app.options.getValue('lang'), { ...getTranslatable(app) }, true);
});
/**
* ============================
* 4. Apply any other behaviour
* ============================
*/
/**
* Currently options set for packages are only stored on the converter and are destroyed before being passed to the {@link Renderer}.
*
* By intercepting the package options set in the converter and storing them on the renderer we can use them later in the theme.
*
*/
app.converter.on(Converter.EVENT_RESOLVE_END, (context) => {
if (app.options.packageDir) {
resolvePackages(app, context, app.options.packageDir);
}
});
setupRenderer(app);
setupInternationalization(app);
}

@@ -97,0 +65,0 @@ /**

@@ -11,2 +11,2 @@ /**

export * from './locales/index.js';
export * from './translatable.js';
export * from './setup.js';

@@ -11,2 +11,2 @@ /**

export * from './locales/index.js';
export * from './translatable.js';
export * from './setup.js';

@@ -1,9 +0,6 @@

import { Application } from 'typedoc';
export {};
/**
* Returns subset of translatable strings for the plugin.
* Translations methods.
*
* These will then be merged with the main set of TypeDoc string.
*
* @category Functions
* @module
*/
export declare function getTranslatable(app: Application): any;

@@ -0,1 +1,2 @@

export {};
/**

@@ -6,24 +7,1 @@ * Translations methods.

*/
import { en, jp, ko, zh } from '../internationalization/index.js';
/**
* Returns subset of translatable strings for the plugin.
*
* These will then be merged with the main set of TypeDoc string.
*
* @category Functions
*/
export function getTranslatable(app) {
const LOCALES = {
en,
jp,
ko,
zh,
};
return {
...LOCALES['en'],
...(app.lang !== 'en' && Object.keys(LOCALES).includes(app.lang)
? { ...LOCALES[app.lang] }
: {}),
...app.options.getValue('locales')[app.lang],
};
}

@@ -6,3 +6,3 @@ /**

*/
export * from './packages.js';
export * from './render.js';
export * from './setup.js';

@@ -6,3 +6,3 @@ /**

*/
export * from './packages.js';
export * from './render.js';
export * from './setup.js';

@@ -1,2 +0,3 @@

import { ProjectReflection, Renderer } from 'typedoc';
import { MarkdownRenderer } from '../types/index.js';
import { ProjectReflection } from 'typedoc';
/**

@@ -13,2 +14,2 @@ * The render method for the Markdown plugin

*/
export declare function render(renderer: Renderer, project: ProjectReflection, outputDirectory: string): Promise<void>;
export declare function render(renderer: MarkdownRenderer, project: ProjectReflection, outputDirectory: string): Promise<void>;
import { MarkdownPageEvent, MarkdownRendererEvent, } from '../events/index.js';
import { MarkdownTheme } from '../public-api.js';
import { MarkdownTheme } from '../theme/index.js';
import * as fs from 'fs';

@@ -30,6 +30,8 @@ import * as path from 'path';

renderer.trigger(MarkdownRendererEvent.BEGIN, output);
await executeJobs(renderer.preRenderAsyncJobs, output);
await executeJobs(renderer.preMarkdownRenderAsyncJobs, output);
await executeJobs(renderer.preRenderAsyncJobs, output); // for backward compatibility
await renderPages(renderer, output);
copyMediaFiles(project, outputDirectory);
await executeJobs(renderer.postRenderAsyncJobs, output);
await executeJobs(renderer.postMarkdownRenderAsyncJobs, output);
await executeJobs(renderer.postRenderAsyncJobs, output); // for backward compatibility
renderer.trigger(MarkdownRendererEvent.END, output);

@@ -36,0 +38,0 @@ renderer.theme = void 0;

@@ -187,2 +187,3 @@ import { isQuoted } from '../../libs/utils/index.js';

path: child.url,
isDeprecated: child.isDeprecated(),
...(children && { children }),

@@ -189,0 +190,0 @@ };

import { MarkdownThemeContext } from '../../../theme/index.js';
import { OptionalType } from 'typedoc';
export declare function optionalType(this: MarkdownThemeContext, model: OptionalType): string;
export declare function optionalType(this: MarkdownThemeContext, model: OptionalType, options?: {
forceCollapse?: boolean;
}): string;

@@ -1,4 +0,6 @@

export function optionalType(model) {
const result = this.partials.someType(model.elementType);
export function optionalType(model, options) {
const result = this.partials.someType(model.elementType, {
forceCollapse: options?.forceCollapse,
});
return model.elementType.type === 'union' ? `(${result})?` : `${result}?`;
}

@@ -52,3 +52,5 @@ import { backTicks } from '../../../libs/markdown/index.js';

if (model instanceof OptionalType) {
return this.partials.optionalType(model);
return this.partials.optionalType(model, {
forceCollapse: options?.forceCollapse,
});
}

@@ -55,0 +57,0 @@ if (model.toString() == 'null') {

@@ -153,3 +153,5 @@ import { MarkdownPageEvent } from '../../events/index.js';

namedTupleType: (model: NamedTupleMember) => string;
optionalType: (model: OptionalType) => string;
optionalType: (model: OptionalType, options?: {
forceCollapse?: boolean | undefined;
} | undefined) => string;
queryType: (model: QueryType) => string;

@@ -156,0 +158,0 @@ referenceType: (model: ReferenceType) => string;

@@ -90,3 +90,3 @@ import { templates, partials, helpers } from './index.js';

namedTupleType: (model) => partials.namedTupleType.apply(context, [model]),
optionalType: (model) => partials.optionalType.apply(context, [model]),
optionalType: (model, options) => partials.optionalType.apply(context, [model, options]),
queryType: (model) => partials.queryType.apply(context, [model]),

@@ -93,0 +93,0 @@ referenceType: (model) => partials.referenceType.apply(context, [model]),

@@ -5,3 +5,3 @@ import { MarkdownPageEvent } from '../events/index.js';

import { RenderTemplate } from '../types/index.js';
import { DeclarationReflection, DocumentReflection, ProjectReflection, Reflection, ReflectionKind, Renderer, Theme } from 'typedoc';
import { DeclarationReflection, DocumentReflection, ProjectReflection, Reflection, ReflectionKind, Theme } from 'typedoc';
/**

@@ -17,3 +17,2 @@ * The main theme class for the plugin.

export declare class MarkdownTheme extends Theme {
constructor(renderer: Renderer);
/**

@@ -20,0 +19,0 @@ * Renders a template and page model to a string.

@@ -16,5 +16,2 @@ import { formatMarkdown } from '../libs/utils/index.js';

export class MarkdownTheme extends Theme {
constructor(renderer) {
super(renderer);
}
/**

@@ -21,0 +18,0 @@ * Renders a template and page model to a string.

@@ -219,3 +219,5 @@ import { MarkdownPageEvent } from '../events/index.js';

namedTupleType: (model: import("typedoc").NamedTupleMember) => string;
optionalType: (model: import("typedoc").OptionalType) => string;
optionalType: (model: import("typedoc").OptionalType, options?: {
forceCollapse?: boolean | undefined;
} | undefined) => string;
queryType: (model: import("typedoc").QueryType) => string;

@@ -222,0 +224,0 @@ referenceType: (model: import("typedoc").ReferenceType) => string;

@@ -38,4 +38,12 @@ import { MarkdownPageEvent, MarkdownRendererEvent } from '../events/index.js';

defineTheme: (name: string, theme: new (renderer: Renderer) => MarkdownTheme) => void;
/**
* Dedicated markdown hooks to add to the renderer
*/
markdownHooks: EventHooks<MarkdownRendererHooks, string>;
/**
* Configure pre and post async jobs
*
* When used with "outputs" is preMarkdownRenderAsyncJobs and postMarkdownRenderAsyncJobs should be used.
*/
/**
* A list of async jobs which must be completed before rendering output.

@@ -45,3 +53,3 @@ *

*/
preRenderAsyncJobs: Array<(output: MarkdownRendererEvent) => Promise<void>>;
preMarkdownRenderAsyncJobs: Array<(output: MarkdownRendererEvent) => Promise<void>>;
/**

@@ -53,3 +61,8 @@ * A list of async jobs which must be completed after rendering output files but before generation is considered successful.

*/
postMarkdownRenderAsyncJobs: Array<(output: MarkdownRendererEvent) => Promise<void>>;
preRenderAsyncJobs: Array<(output: MarkdownRendererEvent) => Promise<void>>;
postRenderAsyncJobs: Array<(output: MarkdownRendererEvent) => Promise<void>>;
/**
* Store meta data about packages
*/
packagesMeta: Record<string, {

@@ -56,0 +69,0 @@ description: string;

{
"name": "typedoc-plugin-markdown",
"version": "4.4.0",
"version": "4.4.1",
"description": "A plugin for TypeDoc that enables TypeScript API documentation to be generated in Markdown.",

@@ -5,0 +5,0 @@ "exports": {

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