How to use the typedoc/dist/lib/converter/components.Component function in typedoc

To help you get started, we’ve selected a few typedoc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tom-grey / typedoc-plugin-markdown / src / plugin.ts View on Github external
import * as path from 'path';
import { Component, ConverterComponent } from 'typedoc/dist/lib/converter/components';
import { Context } from 'typedoc/dist/lib/converter/context';
import { Converter } from 'typedoc/dist/lib/converter/converter';
import { Reflection } from 'typedoc/dist/lib/models/reflections/abstract';
import { PageEvent } from 'typedoc/dist/lib/output/events';
import { OptionsReadMode } from 'typedoc/dist/lib/utils/options';
import { MarkdownTheme } from './theme/';

/**
 * Markdown plugin component that exposes the MarkdownTheme to the application.
 */
@Component({ name: 'markdown' })
export class MarkdownPlugin extends ConverterComponent {
  // listen to event on initialisation
  public initialize() {
    this.listenTo(this.owner, {
      [Converter.EVENT_RESOLVE_BEGIN]: this.onBegin,
    });
    this.listenTo(this.application.renderer, {
      [PageEvent.END]: this.onPageEnd,
    });
  }

  /**
   * * Triggered when the converter begins converting a project.
   */
  private onBegin(context: Context, reflection: Reflection) {
    // renderer
github swimos / swim / swim-js / swim-core-js / @swim / build / main / DocTarget.ts View on Github external
import {Component, ConverterComponent} from "typedoc/dist/lib/converter/components";
import {Converter} from "typedoc/dist/lib/converter/converter";
import {Context} from "typedoc/dist/lib/converter/context";
import {CommentPlugin} from "typedoc/dist/lib/converter/plugins/CommentPlugin";
import {Comment} from "typedoc/dist/lib/models/comments";
import {ContainerReflection} from "typedoc/dist/lib/models/reflections/container";
import {DeclarationReflection} from "typedoc/dist/lib/models/reflections/declaration";

import {Target} from "./Target";

export interface TargetReflection {
  target: Target;
  reflection?: typedoc.Reflection;
}

@Component({name: "doc-target"})
export class DocTarget extends ConverterComponent {
  target: Target;
  fileTargetMap: {[fileName: string]: TargetReflection | undefined};

  initialize() {
    this.listenTo(this.owner, {
      [Converter.EVENT_CREATE_DECLARATION]: this.onDeclarationCreate,
      [Converter.EVENT_RESOLVE_BEGIN]: this.onBeginResolve,
    });
  }

  onDeclarationCreate(context: Context, reflection: typedoc.Reflection): void {
    const fileName = reflection.originalName;
    const fileInfo = this.fileTargetMap[fileName];
    if (fileInfo) {
      fileInfo.reflection = reflection;
github GregRos / parjs / src / generate-docs / typedoc-plugin.ts View on Github external
import {Component, ConverterComponent} from "typedoc/dist/lib/converter/components";
import {Converter} from "typedoc/dist/lib/converter/converter";
import {Context} from "typedoc/dist/lib/converter/context";
import {CommentPlugin} from "typedoc/dist/lib/converter/plugins/CommentPlugin";
import * as _ from "lodash";

@Component({name: "parjs-customization"})
export class ParjsCustomizationPlugin extends ConverterComponent {
    initialize() {
        this.listenTo(this.owner, {
            [Converter.EVENT_RESOLVE_BEGIN]: this._onBeginResolve,
        });
    }


    private _onBeginResolve(context: Context) {
        let arr = _.map(context.project.reflections, x => x);
        arr.forEach(x => {
            let remove = false;

            if (x.flags.isExternal) {
                x.flags.isExternal = false;
            }
github stimulusjs / stimulus / packages / typedoc-plugin-stimulus / src / remove_private_methods.ts View on Github external
import { CommentPlugin } from "typedoc/dist/lib/converter/plugins/CommentPlugin"
import { Component, ConverterComponent } from "typedoc/dist/lib/converter/components"
import { Context } from "typedoc/dist/lib/converter/context"
import { Converter } from "typedoc/dist/lib/converter"
import { ProjectReflection } from "typedoc/dist/lib/models/reflections/project"
import { Reflection } from "typedoc/dist/lib/models/reflections/abstract"
import { ReflectionKind } from "typedoc/dist/lib/models/reflections"

@Component({ name: "remove-private-methods" })
export class RemovePrivateMethodsPlugin extends ConverterComponent {
  private markedReflections: Reflection[] = []

  initialize() {
    this.listenTo(this.owner, {
      [Converter.EVENT_CREATE_SIGNATURE]: this.createSignature,
      [Converter.EVENT_RESOLVE_BEGIN]:    this.resolveBegin
    })
  }

  createSignature(context: Context, reflection: Reflection) {
    if (reflection.flags.isPrivate) {
      this.markedReflections.push(reflection)
    }
  }
github tom-grey / typedoc-plugin-markdown / src / plugin.ts View on Github external
import * as path from 'path';
import { Renderer } from 'typedoc';
import { Converter } from 'typedoc/dist/lib/converter';
import { Component, ConverterComponent } from 'typedoc/dist/lib/converter/components';

@Component({ name: 'markdown' })
export class MarkdownPlugin extends ConverterComponent {
  initialize() {
    this.listenTo(this.owner, {
      [Converter.EVENT_BEGIN]: this.onBegin,
      [Converter.EVENT_RESOLVE_BEGIN]: this.onResolveBegin,
    });
  }

  /**
   * Overide the default assets for any custom themes to inherit
   */
  onBegin() {
    Renderer.getDefaultTheme = () => path.join(__dirname, 'resources');
  }

  /**
github swimos / swim / swim-system-js / swim-core-js / @swim / build / main / DocTarget.ts View on Github external
import * as path from "path";
import * as typedoc from "typedoc";
import {Component, ConverterComponent} from "typedoc/dist/lib/converter/components";
import {Converter} from "typedoc/dist/lib/converter/converter";
import {Context} from "typedoc/dist/lib/converter/context";
import {CommentPlugin} from "typedoc/dist/lib/converter/plugins/CommentPlugin";
import {Comment} from "typedoc/dist/lib/models/comments";

import {Target} from "./Target";

export interface TargetReflection {
  target: Target;
  reflection?: typedoc.Reflection;
}

@Component({name: "doc-target"})
export class DocTarget extends ConverterComponent {
  target: Target;
  fileTargetMap: {[fileName: string]: TargetReflection | undefined};

  initialize() {
    this.listenTo(this.owner, {
      [Converter.EVENT_CREATE_DECLARATION]: this.onDeclarationCreate,
      [Converter.EVENT_RESOLVE_BEGIN]: this.onBeginResolve,
    });
  }

  onDeclarationCreate(context: Context, reflection: typedoc.Reflection): void {
    const fileName = reflection.originalName;
    const fileInfo = this.fileTargetMap[fileName];
    if (fileInfo) {
      fileInfo.reflection = reflection;