Documentalist

Compiler

Client

API Reference

Classes

CompilerDocumentalistKssPluginMarkdownPluginNpmPluginPageMapRouterTypescriptPluginVisitor

Interfaces

IBlockICompilerICompilerOptionsIFileIHeadingNodeIHeadingTagIKssExampleIKssModifierIKssPluginDataIMarkdownPluginDataIMarkdownPluginOptionsIMetadataINavigableINpmPackageINpmPluginDataINpmPluginOptionsIPageDataIPageNodeIPluginIPluginEntryIRouteITagITsAccessorITsCallableITsClassITsConstructorITsDefaultValueITsDocBaseITsEnumITsEnumMemberITsFlagsITsInterfaceITsMethodITsObjectDefinitionITsParameterITsPropertyITsSignatureITsTypeAliasITypescriptPluginDataITypescriptPluginOptions

Enums

Kind

Aliases

StringOrTag

v4.0.0

© Copyright 2017-present Palantir

Client

Now that you've compiled a sweet data file packed with documentation goodness, what next?

Well, you've got some options. This package does not provide the tools to render the data, but they're fairly easy to construct once you understand the data format. The @documentalist/client package provides functions, interfaces, and type guards for working with the output of the compiler.

  • Check out the private @documentalist/docs package for our simple Pug template that renders the GitHub Pages site.
  • Blueprint publishes a React theme in the @blueprintjs/docs-theme package (the same one that powers https://blueprintjs.com/docs).

page: overview

page: compiler

page: client

Compiler

Register plugins with .use(pattern, plugin). Supply a pattern to match files against; matched files will be compiled by the plugin. Documentation data will be collected into a single blob and can be easily written to a file or fed into another tool.

const { Documentalist, MarkdownPlugin, TypescriptPlugin } = require("@documentalist/compiler");
const { writeFileSync } = require("fs");

new Documentalist()
  .use(".md", new MarkdownPlugin())
  .use(/\.tsx?$/, new TypescriptPlugin({ excludeNames: [/I.+State$/] }))
  .documentGlobs("src/**/*") // ← async operation, returns a Promise
  .then(docs => JSON.stringify(docs, null, 2))
  .then(json => writeFileSync("docs.json", json))

class Documentalist #

Exported from: @documentalist/compiler

Constructor

new Documentalist
(options?: ICompilerOptions, plugins?: Array<IPluginEntry<T>>) => Documentalist

Methods

static create
(options?: ICompilerOptions) => Documentalist<>

Construct a new Documentalist instance with the provided options. This method lends itself particularly well to the chaining syntax: Documentalist.create(options).use(...).

clearPlugins
() => Documentalist<>

Returns a new instance of Documentalist with no plugins.

documentFiles
(files: IFile[]) => Promise<T>

Iterates over all plugins, passing all matching files to each in turn. The output of each plugin is merged to produce the resulting documentation object.

The return type T is a union of each plugin's data type.

documentGlobs
(...filesGlobs: string[]) => Promise<T>

Finds all files matching the provided variadic glob expressions and then runs documentFiles with them, emitting all the documentation data.

use
(pattern: RegExp | string, plugin: IPlugin<P>) => Documentalist<T & P>

Adds the plugin to Documentalist. Returns a new instance of Documentalist with a template type that includes the data from the plugin. This way the documentFiles and documentGlobs methods will return an object that is already typed to include each plugin's output.

The plugin is applied to all files whose absolute path matches the supplied pattern.

CLI

On the command line, the Markdown and Typescript plugins are enabled by default. The CSS plugin can be enabled with --css. Plugins can be disabled with the no- prefix.

Options are not supported via the command line interface :sob:.

documentalist "src/**/*" --css --no-ts > docs.json

Plugins

Documentalist uses a plugin architecture to support arbitrary file types. Use your own plugins by passing them to dm.use(pattern, plugin) with a pattern to match against source files. The collected matched files will be passed to your plugin's compile function, along with a compiler instance that can be used to render blocks of markdown text.

interface IPlugin #

Exported from: @documentalist/client

A Documentalist plugin is an object with a compile(files, compiler) function that returns a data object (or a promise for that object).

A common pattern is to define a class that implements this interface and use the constructor to accept options.

import { ICompiler, IFile, IPlugin } from "documentalist/client";

export interface MyData {
    pluginName: { ... }
}

export interface MyOptions {
    ...
}

export class MyPlugin implements IPlugin<MyData> {
    public constructor(options: MyOptions = {}) {}

    public compile(files: IFile[], compiler: ICompiler) {
        return files.map(transformToMyData);
    }
}

Methods

compile
(files: IFile[], compiler: ICompiler) => T | Promise<T>

Overview

A sort-of-static site generator optimized for living documentation of software projects.

npm npm CircleCI

Documentalism 101

Documentalism is a two-step process:

  1. Get the data.
  2. Render the data.

The Documentalist compiler is an extensible solution to step 1: it helps you get all your data in one place, in a consistent format. Configure Documentalist with plugins to extract documentation data from source files, then feed it a glob of files and await your magical blob of documentation data!

Packages

This project contains multiple NPM packages:

  • @documentalist/compiler
  • @documentalist/client

License

This project is made available under the Apache-2.0 License.

class Compiler implements ICompiler #

Exported from: @documentalist/compiler

Constructor

new Compiler
(options: ICompilerOptions) => Compiler

Methods

objectify
(array: T[], getKey: (item: T) => string) => { [key: string]: T }
relativePath
(path: string) => string
renderBlock
(blockContent: string, reservedTagWords?: string[]) => IBlock
renderMarkdown
(markdown: string) => string

class Documentalist #

Exported from: @documentalist/compiler

Constructor

new Documentalist
(options?: ICompilerOptions, plugins?: Array<IPluginEntry<T>>) => Documentalist

Methods

static create
(options?: ICompilerOptions) => Documentalist<>

Construct a new Documentalist instance with the provided options. This method lends itself particularly well to the chaining syntax: Documentalist.create(options).use(...).

clearPlugins
() => Documentalist<>

Returns a new instance of Documentalist with no plugins.

documentFiles
(files: IFile[]) => Promise<T>

Iterates over all plugins, passing all matching files to each in turn. The output of each plugin is merged to produce the resulting documentation object.

The return type T is a union of each plugin's data type.

documentGlobs
(...filesGlobs: string[]) => Promise<T>

Finds all files matching the provided variadic glob expressions and then runs documentFiles with them, emitting all the documentation data.

use
(pattern: RegExp | string, plugin: IPlugin<P>) => Documentalist<T & P>

Adds the plugin to Documentalist. Returns a new instance of Documentalist with a template type that includes the data from the plugin. This way the documentFiles and documentGlobs methods will return an object that is already typed to include each plugin's output.

The plugin is applied to all files whose absolute path matches the supplied pattern.

class PageMap #

Exported from: @documentalist/compiler

Methods

get
(id: string) => IPageData

Returns the page with the given ID or undefined if not found.

pages
() => IPageData[]

Returns an iterator for all the pages (values) in the map.

remove
(id: string) => IPageData

Removes the page with the given ID and returns it or undefined if not found.

set
(id: string, page: IPageData) => void

Sets the page data at the given ID, when you already have a full page object. Warns if a page with this ID already exists.

toObject
() => { [key: string]: IPageData }

Returns a JS object mapping page IDs to data.

toTree
(id: string, depth?: number) => IPageNode

class MarkdownPlugin implements IPlugin<IMarkdownPluginData> #

Exported from: @documentalist/compiler

The MarkdownPlugin parses and renders markdown pages and produces a navigation tree of all documents. This plugin traces @page and @#+ "heading" tags to discover pages (given a single starting navPage) and build up a tree representation of those pages.

see: IPageData (rendered markdown page)

see: IPageNode (node in navigation tree)

Constructor

new MarkdownPlugin
(options?: Partial<IMarkdownPluginOptions>) => MarkdownPlugin

Methods

compile
(markdownFiles: IFile[], compiler: ICompiler) => IMarkdownPluginData

Reads the given set of markdown files and adds their data to the internal storage. Returns a plain object mapping page references to their data.

class NpmPlugin implements IPlugin<INpmPluginData> #

Exported from: @documentalist/compiler

The NpmPlugin parses package.json files and emits data about each NPM package. It uses npm info to look up data about published packages, and falls back to package.json info if the package is private or unpublished.

Constructor

new NpmPlugin
(options?: INpmPluginOptions) => NpmPlugin

Methods

compile
(packageJsons: IFile[], dm: ICompiler) => INpmPluginData

class Visitor #

Exported from: @documentalist/compiler

Constructor

new Visitor
(compiler: ICompiler, options: ITypescriptPluginOptions) => Visitor

Methods

visitProject
(project: ProjectReflection) => (ITsClass<> | ITsEnum<> | ITsMethod<> | ITsInterface<> | ITsTypeAlias<>)[]

class TypescriptPlugin implements IPlugin<ITypescriptPluginData> #

Exported from: @documentalist/compiler

Constructor

new TypescriptPlugin
(options?: ITypescriptPluginOptions) => TypescriptPlugin

Methods

compile
(files: IFile[], compiler: ICompiler) => ITypescriptPluginData

class KssPlugin implements IPlugin<IKssPluginData> #

Exported from: @documentalist/compiler

The KssPlugin extracts KSS doc comments from CSS code (or similar languages). It emits an object keyed by the "styleguide [ref]" section of the comment. The documentation, markup, and modifiers sections will all be emitted in the data.

see: IKssExample

Constructor

new KssPlugin
(options?: Options) => KssPlugin

Methods

compile
(cssFiles: IFile[], dm: ICompiler) => IKssPluginData

class Router #

Exported from: @documentalist/index.ts

Constructor

new Router
(el: HTMLElement, defaultRoute?: string) => Router

Properties

el
HTMLElement

Methods

register
(route: IRoute) => void
route
() => void
start
() => void

enum Kind #

Exported from: @documentalist/client

Enumeration describing the various kinds of member supported by this plugin.

Members

Accessor
= "accessor"
Class
= "class"
Constructor
= "constructor"
Enum
= "enum"
EnumMember
= "enum member"
Interface
= "interface"
Method
= "method"
Parameter
= "parameter"
Property
= "property"
Signature
= "signature"
TypeAlias
= "type alias"

method isTag #

Exported from: @documentalist/client

method isHeadingTag #

Exported from: @documentalist/client

method isPageNode #

Exported from: @documentalist/client

method typeguard #

Exported from: @documentalist/client

method linkify #

Exported from: @documentalist/client

method slugify #

Exported from: @documentalist/client

method initPageNode #

Exported from: @documentalist/compiler

method initHeadingNode #

Exported from: @documentalist/compiler

method getReference #

Exported from: @documentalist/compiler

method getTitle #

Exported from: @documentalist/compiler

method arrayToObject #

Exported from: @documentalist/compiler

method isNotExcluded #

Exported from: @documentalist/compiler

method resolveTypeString #

Exported from: @documentalist/compiler

method resolveReferenceName #

Exported from: @documentalist/compiler

method resolveSignature #

Exported from: @documentalist/compiler

method getCommentTag #

Exported from: @documentalist/compiler

method getDefaultValue #

Exported from: @documentalist/compiler

method getSourceFileName #

Exported from: @documentalist/compiler

method getSourceUrl #

Exported from: @documentalist/compiler

method getFlags #

Exported from: @documentalist/compiler

method getIsDeprecated #

Exported from: @documentalist/compiler

method isConstTypePair #

Exported from: @documentalist/compiler

method sortStaticFirst #

Exported from: @documentalist/compiler

method convertSection #

Exported from: @documentalist/compiler

method convertModifier #

Exported from: @documentalist/compiler

method queryAll #

Exported from: @documentalist/index.ts

method selectCurrent #

Exported from: @documentalist/index.ts

interface ITag #

Exported from: @documentalist/client

Represents a single @tag <value> line from a file.

Properties

tag
string

Tag name.

value
string

Tag value, exactly as written in source.

interface INavigable #

Exported from: @documentalist/client

The basic components of a navigable resource: a "route" at which it can be accessed and its depth in the layout hierarchy. Heading tags and hierarchy nodes both extend this interface.

Properties

level
number

Level of heading, from 1-6. Dictates which <h#> tag to render.

route
string

Fully-qualified route of the heading, which can be used as anchor href.

interface IHeadingTag extends ITag, INavigable #

Exported from: @documentalist/client

Represents a single @#+ <value> heading tag from a file. Note that all @#+ tags (@# through @######) are emitted as tag: "heading" so only one renderer is necessary to capture all six levels.

Heading tags include additional information over regular tags: fully-qualified route of the heading (which can be used as anchor href), and level to determine which <h#> tag to use.

Properties

level
numberInherited from INavigable.level

Level of heading, from 1-6. Dictates which <h#> tag to render.

route
stringInherited from INavigable.route

Fully-qualified route of the heading, which can be used as anchor href.

tag
"heading"
value
stringInherited from ITag.value

Tag value, exactly as written in source.

interface ICompiler #

Exported from: @documentalist/client

Each plugin receives a Compiler instance to aid in the processing of source files.

Methods

objectify
(array: T[], getKey: (item: T) => string) => { [key: string]: T }

Converts an array of entries into a map of key to entry, using given callback to extract key from each item.

relativePath
(path: string) => string

Get the relative path from sourceBaseDir to the given path.

renderBlock
(blockContent: string, reservedTagWords?: string[]) => IBlock

Render a block of content by extracting metadata (YAML front matter) and splitting text content into markdown-rendered HTML strings and { tag, value } objects.

To prevent special strings like "@include" from being parsed, a reserved tag words array may be provided, in which case the line will be left as is.

renderMarkdown
(markdown: string) => string

Render a string of markdown to HTML, using the options from Documentalist.

interface IMetadata #

Exported from: @documentalist/client

Metadata is parsed from YAML front matter in files and can contain arbitrary data. A few keys are understood by Documentalist and, if defined in front matter, will override default behavior.

---
reference: overview
title: "Welcome to the Jungle"
---
actual contents of file...

Properties

reference
string = filename without extension

Unique ID for addressing this page.

title
string = value of first `@#` tag

Human-friendly title of this page, for display in the UI.

interface IBlock #

Exported from: @documentalist/client

The output of renderBlock which parses a long form documentation block into metadata, rendered markdown, and tags.

Properties

contents
StringOrTag[]

Parsed nodes of source file. An array of markdown-rendered HTML strings or @tag objects.

contentsRaw
string

Raw unmodified contents of source file (excluding the metadata).

metadata
IMetadata

Arbitrary YAML metadata parsed from front matter of source file, if any, or {}.

interface IKssModifier #

Exported from: @documentalist/client

A single modifier for an example.

Properties

documentation
string
name
string

interface IKssExample #

Exported from: @documentalist/client

A markup/modifiers example parsed from a KSS comment block.

Properties

documentation
string

Raw documentation string.

markup
string

Raw HTML markup for example with {{.modifier}} templates, to be used to render the markup for each modifier.

markupHtml
string

Syntax-highlighted version of the markup HTML, to be used for rendering the markup itself with pretty colors.

modifiers
IKssModifier[]

Array of modifiers supported by HTML markup.

reference
string

Unique reference for addressing this example.

interface IKssPluginData #

Exported from: @documentalist/client

The KssPlugin exports a css key that contains a map of styleguide references to markup/modifier examples.

see: KSSPlugin

Properties

css
{ [reference: string]: IKssExample }

interface IMarkdownPluginData #

Exported from: @documentalist/client

The MarkdownPlugin exports a map of markdown pages keyed by reference, and a multi-rooted nav tree of page nodes.

Properties

nav
IPageNode[]

An ordered, nested, multi-rooted tree describing the navigation layout of all the pages and their headings. The representation is constructued by tracing @page and @#+ tags.

pages
{ [reference: string]: IPageData }

A map of page reference to data.

interface IPageData extends IBlock #

Exported from: @documentalist/client

A single Documentalist page, parsed from a single source file.

Properties

contents
StringOrTag[]Inherited from IBlock.contents

Parsed nodes of source file. An array of markdown-rendered HTML strings or @tag objects.

contentsRaw
stringInherited from IBlock.contentsRaw

Raw unmodified contents of source file (excluding the metadata).

metadata
IMetadataInherited from IBlock.metadata

Arbitrary YAML metadata parsed from front matter of source file, if any, or {}.

reference
string

Unique identifier for addressing this page.

route
string

Fully qualified route to this page: slash-separated references of all parent pages.

sourcePath
string

Relative path from cwd to the original source file.

title
string

Human-friendly title of this page.

interface IHeadingNode extends INavigable #

Exported from: @documentalist/client

An @#+ tag belongs to a specific page.

Properties

level
numberInherited from INavigable.level

Level of heading, from 1-6. Dictates which <h#> tag to render.

route
stringInherited from INavigable.route

Fully-qualified route of the heading, which can be used as anchor href.

title
string

Display title of page heading.

interface IPageNode extends IHeadingNode #

Exported from: @documentalist/client

A page has ordered children composed of @#+ and @page tags.

Properties

children
Array<IPageNode | IHeadingNode>

Ordered list of pages and headings that appear on this page.

level
numberInherited from INavigable.level

Level of heading, from 1-6. Dictates which <h#> tag to render.

reference
string

Unique reference of this page, used for retrieval from store.

route
stringInherited from INavigable.route

Fully-qualified route of the heading, which can be used as anchor href.

title
stringInherited from IHeadingNode.title

Display title of page heading.

interface INpmPackage #

Exported from: @documentalist/client

NPM package metadata

Properties

description
string

Package description.

latestVersion
string

NPM latest dist-tag version.

name
string

Package name.

nextVersion
string

NPM next dist-tag version.

private
boolean

Whether this package is marked private.

published
boolean

Whether this package is published to NPM.

sourcePath
string

Relative path from sourceBaseDir to this package.

version
string

Version string from package.json.

versions
string[]

All published versions of this package. If published, this contains only version.

interface INpmPluginData #

Exported from: @documentalist/client

The KssPlugin exports a css key that contains a map of styleguide references to markup/modifier examples.

see: KSSPlugin

Properties

npm
{ [packageName: string]: INpmPackage }

interface IPlugin #

Exported from: @documentalist/client

A Documentalist plugin is an object with a compile(files, compiler) function that returns a data object (or a promise for that object).

A common pattern is to define a class that implements this interface and use the constructor to accept options.

import { ICompiler, IFile, IPlugin } from "documentalist/client";

export interface MyData {
    pluginName: { ... }
}

export interface MyOptions {
    ...
}

export class MyPlugin implements IPlugin<MyData> {
    public constructor(options: MyOptions = {}) {}

    public compile(files: IFile[], compiler: ICompiler) {
        return files.map(transformToMyData);
    }
}

Methods

compile
(files: IFile[], compiler: ICompiler) => T | Promise<T>

interface IFile #

Exported from: @documentalist/client

Abstract representation of a file, containing absolute path and synchronous read operation. This allows plugins to use only the path of a file without reading it.

Properties

path
string

Methods

read
() => string

interface ITsFlags #

Exported from: @documentalist/client

Compiler flags about this member.

Properties

isDeprecated
boolean | string

This flag supports an optional message, typically used to include a version number.

isExported
boolean
isExternal
boolean
isOptional
boolean
isPrivate
boolean
isProtected
boolean
isPublic
boolean
isRest
boolean
isStatic
boolean

interface ITsDocBase #

Exported from: @documentalist/client

Base type for all typescript documentation members.

Properties

documentation
IBlock

Compiled documentation: contents field contains an array of markdown strings or @tag value objects.

fileName
string

Original file name in which this member originated, relative to current working directory.

flags
ITsFlags
kind
K

Type brand indicating kind of member; type guards will reveal further information about it.

name
string

Name of this member in code, also used as its identifiers in the data store.

sourceUrl
string

Absolute URL pointing to source file in repository, including line number. If gitBranch option is provided to the TypescriptPlugin, the URL will reference that branch. Otherwise, it will reference the current commit hash.

see: ITypescriptPluginOptions.gitBranch

interface ITsCallable #

Exported from: @documentalist/client

Common type for a callable member, something that can be invoked.

see: ITsConstructor

see: ITsMethod

Properties

inheritedFrom
string

Type name from which this method was inherited. Typically takes the form Interface.member.

signatures
ITsSignature[]

A method has at least one signature, which describes the parameters and return type and contains documentation.

interface ITsDefaultValue #

Exported from: @documentalist/client

Re-usable interface for Typescript members that support a notion of "default value."

Properties

defaultValue
string

The default value of this property, from an initializer or an @default tag.

interface ITsObjectDefinition #

Exported from: @documentalist/client

Re-usable interface for Typescript members that look like objects.

Properties

extends
string[]

List of type strings that this definition extends.

implements
string[]

List of type names that this definition implements.

indexSignature
ITsSignature

Index signature for this object, if declared.

methods
ITsMethod[]

Method members of this definiton.

properties
ITsProperty[]

Property members of this definition.

interface ITsConstructor extends ITsDocBase, ITsCallable #

Exported from: @documentalist/client

Documentation for a class constructor. See signatures array for actual callable signatures and rendered docs.

see: ITsClass

Properties

documentation
IBlockInherited from ITsDocBase.documentation

Compiled documentation: contents field contains an array of markdown strings or @tag value objects.

fileName
stringInherited from ITsDocBase.fileName

Original file name in which this member originated, relative to current working directory.

flags
ITsFlagsInherited from ITsDocBase.flags
inheritedFrom
stringInherited from ITsCallable.inheritedFrom

Type name from which this method was inherited. Typically takes the form Interface.member.

kind
Kind.Constructor
name
stringInherited from ITsDocBase.name

Name of this member in code, also used as its identifiers in the data store.

signatures
ITsSignature[]Inherited from ITsCallable.signatures

A method has at least one signature, which describes the parameters and return type and contains documentation.

sourceUrl
stringInherited from ITsDocBase.sourceUrl

Absolute URL pointing to source file in repository, including line number. If gitBranch option is provided to the TypescriptPlugin, the URL will reference that branch. Otherwise, it will reference the current commit hash.

see: ITypescriptPluginOptions.gitBranch

interface ITsAccessor extends ITsDocBase #

Exported from: @documentalist/client

Properties

documentation
IBlockInherited from ITsDocBase.documentation

Compiled documentation: contents field contains an array of markdown strings or @tag value objects.

fileName
stringInherited from ITsDocBase.fileName

Original file name in which this member originated, relative to current working directory.

flags
ITsFlagsInherited from ITsDocBase.flags
getDocumentation
IBlock | undefined

If a set signature is defined and documented for this accessor, this will contain its documentation.

kind
Kind.Accessor
name
stringInherited from ITsDocBase.name

Name of this member in code, also used as its identifiers in the data store.

setDocumentation
IBlock | undefined

If a get signature is defined and documented for this accessor, this will contain its documentation.

sourceUrl
stringInherited from ITsDocBase.sourceUrl

Absolute URL pointing to source file in repository, including line number. If gitBranch option is provided to the TypescriptPlugin, the URL will reference that branch. Otherwise, it will reference the current commit hash.

see: ITypescriptPluginOptions.gitBranch

type
string

Type of the accessor.

interface ITsMethod extends ITsDocBase, ITsCallable #

Exported from: @documentalist/client

Documentation for a method. See signatures array for actual callable signatures and rendered docs.

Properties

documentation
IBlockInherited from ITsDocBase.documentation

Compiled documentation: contents field contains an array of markdown strings or @tag value objects.

fileName
stringInherited from ITsDocBase.fileName

Original file name in which this member originated, relative to current working directory.

flags
ITsFlagsInherited from ITsDocBase.flags
inheritedFrom
stringInherited from ITsCallable.inheritedFrom

Type name from which this method was inherited. Typically takes the form Interface.member.

kind
Kind.Method
name
stringInherited from ITsDocBase.name

Name of this member in code, also used as its identifiers in the data store.

signatures
ITsSignature[]Inherited from ITsCallable.signatures

A method has at least one signature, which describes the parameters and return type and contains documentation.

sourceUrl
stringInherited from ITsDocBase.sourceUrl

Absolute URL pointing to source file in repository, including line number. If gitBranch option is provided to the TypescriptPlugin, the URL will reference that branch. Otherwise, it will reference the current commit hash.

see: ITypescriptPluginOptions.gitBranch

interface ITsSignature extends ITsDocBase #

Exported from: @documentalist/client

Documentation for a single signature, including parameters, return type, and full type string. Signatures are used for methods and constructors on classes or interfaces, and for index signatures on objects.

Properties

documentation
IBlockInherited from ITsDocBase.documentation

Compiled documentation: contents field contains an array of markdown strings or @tag value objects.

fileName
stringInherited from ITsDocBase.fileName

Original file name in which this member originated, relative to current working directory.

flags
undefined

Signatures do not have flags of their own. Flags can be found on the parent and on each parameter.

kind
Kind.Signature
name
stringInherited from ITsDocBase.name

Name of this member in code, also used as its identifiers in the data store.

parameters
ITsParameter[]

Signature parameters, each with their own docs and data.

returnType
string

Return type of the signature.

sourceUrl
stringInherited from ITsDocBase.sourceUrl

Absolute URL pointing to source file in repository, including line number. If gitBranch option is provided to the TypescriptPlugin, the URL will reference that branch. Otherwise, it will reference the current commit hash.

see: ITypescriptPluginOptions.gitBranch

type
string

Fully qualified type string describing this method, including parameters and return type.

interface ITsParameter extends ITsDocBase, ITsDefaultValue #

Exported from: @documentalist/client

Documentation for a single parameter to a signature.

Properties

defaultValue
stringInherited from ITsDefaultValue.defaultValue

The default value of this property, from an initializer or an @default tag.

documentation
IBlockInherited from ITsDocBase.documentation

Compiled documentation: contents field contains an array of markdown strings or @tag value objects.

fileName
stringInherited from ITsDocBase.fileName

Original file name in which this member originated, relative to current working directory.

flags
ITsFlagsInherited from ITsDocBase.flags
kind
Kind.Parameter
name
stringInherited from ITsDocBase.name

Name of this member in code, also used as its identifiers in the data store.

sourceUrl
undefined

Parameters do not have their own URL; see the containing signature.

type
string

Fully qualified type string describing this parameter.

interface ITsProperty extends ITsDocBase, ITsDefaultValue #

Exported from: @documentalist/client

Documentation for a property of an object, which may have a default value.

Properties

defaultValue
stringInherited from ITsDefaultValue.defaultValue

The default value of this property, from an initializer or an @default tag.

documentation
IBlockInherited from ITsDocBase.documentation

Compiled documentation: contents field contains an array of markdown strings or @tag value objects.

fileName
stringInherited from ITsDocBase.fileName

Original file name in which this member originated, relative to current working directory.

flags
ITsFlagsInherited from ITsDocBase.flags
inheritedFrom
string

Type name from which this property was inherited. Typically takes the form Interface.member.

kind
Kind.Property
name
stringInherited from ITsDocBase.name

Name of this member in code, also used as its identifiers in the data store.

sourceUrl
stringInherited from ITsDocBase.sourceUrl

Absolute URL pointing to source file in repository, including line number. If gitBranch option is provided to the TypescriptPlugin, the URL will reference that branch. Otherwise, it will reference the current commit hash.

see: ITypescriptPluginOptions.gitBranch

type
string

Type string describing this property.

interface ITsInterface extends ITsDocBase, ITsObjectDefinition #

Exported from: @documentalist/client

Documentation for an interface definition.

Properties

documentation
IBlockInherited from ITsDocBase.documentation

Compiled documentation: contents field contains an array of markdown strings or @tag value objects.

extends
string[]Inherited from ITsObjectDefinition.extends

List of type strings that this definition extends.

fileName
stringInherited from ITsDocBase.fileName

Original file name in which this member originated, relative to current working directory.

flags
ITsFlagsInherited from ITsDocBase.flags
implements
string[]Inherited from ITsObjectDefinition.implements

List of type names that this definition implements.

indexSignature
ITsSignatureInherited from ITsObjectDefinition.indexSignature

Index signature for this object, if declared.

kind
Kind.Interface
methods
ITsMethod[]Inherited from ITsObjectDefinition.methods

Method members of this definiton.

name
stringInherited from ITsDocBase.name

Name of this member in code, also used as its identifiers in the data store.

properties
ITsProperty[]Inherited from ITsObjectDefinition.properties

Property members of this definition.

sourceUrl
stringInherited from ITsDocBase.sourceUrl

Absolute URL pointing to source file in repository, including line number. If gitBranch option is provided to the TypescriptPlugin, the URL will reference that branch. Otherwise, it will reference the current commit hash.

see: ITypescriptPluginOptions.gitBranch

interface ITsClass extends ITsDocBase, ITsObjectDefinition #

Exported from: @documentalist/client

Documentation for a class definition.

Properties

accessors
ITsAccessor[]
constructorType
ITsConstructor

Constructor signature of this class. Note the special name here, as constructor is a JavaScript keyword.

documentation
IBlockInherited from ITsDocBase.documentation

Compiled documentation: contents field contains an array of markdown strings or @tag value objects.

extends
string[]Inherited from ITsObjectDefinition.extends

List of type strings that this definition extends.

fileName
stringInherited from ITsDocBase.fileName

Original file name in which this member originated, relative to current working directory.

flags
ITsFlagsInherited from ITsDocBase.flags
implements
string[]Inherited from ITsObjectDefinition.implements

List of type names that this definition implements.

indexSignature
ITsSignatureInherited from ITsObjectDefinition.indexSignature

Index signature for this object, if declared.

kind
Kind.Class
methods
ITsMethod[]Inherited from ITsObjectDefinition.methods

Method members of this definiton.

name
stringInherited from ITsDocBase.name

Name of this member in code, also used as its identifiers in the data store.

properties
ITsProperty[]Inherited from ITsObjectDefinition.properties

Property members of this definition.

sourceUrl
stringInherited from ITsDocBase.sourceUrl

Absolute URL pointing to source file in repository, including line number. If gitBranch option is provided to the TypescriptPlugin, the URL will reference that branch. Otherwise, it will reference the current commit hash.

see: ITypescriptPluginOptions.gitBranch

interface ITsEnumMember extends ITsDocBase, ITsDefaultValue #

Exported from: @documentalist/client

A member of an enum definition. An enum member will have a defaultValue if it was declared with an initializer.

Properties

defaultValue
stringInherited from ITsDefaultValue.defaultValue

The default value of this property, from an initializer or an @default tag.

documentation
IBlockInherited from ITsDocBase.documentation

Compiled documentation: contents field contains an array of markdown strings or @tag value objects.

fileName
stringInherited from ITsDocBase.fileName

Original file name in which this member originated, relative to current working directory.

flags
ITsFlagsInherited from ITsDocBase.flags
kind
Kind.EnumMember
name
stringInherited from ITsDocBase.name

Name of this member in code, also used as its identifiers in the data store.

sourceUrl
stringInherited from ITsDocBase.sourceUrl

Absolute URL pointing to source file in repository, including line number. If gitBranch option is provided to the TypescriptPlugin, the URL will reference that branch. Otherwise, it will reference the current commit hash.

see: ITypescriptPluginOptions.gitBranch

interface ITsEnum extends ITsDocBase #

Exported from: @documentalist/client

Documentation for an enum definition.

Properties

documentation
IBlockInherited from ITsDocBase.documentation

Compiled documentation: contents field contains an array of markdown strings or @tag value objects.

fileName
stringInherited from ITsDocBase.fileName

Original file name in which this member originated, relative to current working directory.

flags
ITsFlagsInherited from ITsDocBase.flags
kind
Kind.Enum
members
ITsEnumMember[]

Enumeration members.

name
stringInherited from ITsDocBase.name

Name of this member in code, also used as its identifiers in the data store.

sourceUrl
stringInherited from ITsDocBase.sourceUrl

Absolute URL pointing to source file in repository, including line number. If gitBranch option is provided to the TypescriptPlugin, the URL will reference that branch. Otherwise, it will reference the current commit hash.

see: ITypescriptPluginOptions.gitBranch

interface ITsTypeAlias extends ITsDocBase #

Exported from: @documentalist/client

A type alias, defined using export type {name} = {type}. The type property will contain the full type alias as a string.

Properties

documentation
IBlockInherited from ITsDocBase.documentation

Compiled documentation: contents field contains an array of markdown strings or @tag value objects.

fileName
stringInherited from ITsDocBase.fileName

Original file name in which this member originated, relative to current working directory.

flags
ITsFlagsInherited from ITsDocBase.flags
kind
Kind.TypeAlias
name
stringInherited from ITsDocBase.name

Name of this member in code, also used as its identifiers in the data store.

sourceUrl
stringInherited from ITsDocBase.sourceUrl

Absolute URL pointing to source file in repository, including line number. If gitBranch option is provided to the TypescriptPlugin, the URL will reference that branch. Otherwise, it will reference the current commit hash.

see: ITypescriptPluginOptions.gitBranch

type
string

Type string for which this member is an alias.

interface ITypescriptPluginData #

Exported from: @documentalist/client

The TypescriptPlugin exports a typescript key that contains a map of member name to class or interface definition.

Only classes and interfaces are provided at this root level, but each member contains full information about its children, such as methods (and signatures and parameters) and properties.

Properties

typescript
{ [name: string]: ITsClass | ITsInterface | ITsEnum | ITsMethod | ITsTypeAlias }

interface ICompilerOptions #

Exported from: @documentalist/compiler

Properties

markdown
MarkedOptions

Options for markdown rendering. See https://github.com/chjj/marked#options-1.

reservedTags
string[]

Reserved @tags that should be preserved in the contents string. A common use case is allowing specific code constructs, like @Decorator names. Do not include the @ prefix in the strings.

sourceBaseDir
string = process.cwd()

Base directory for generating relative sourcePaths.

This option does not affect glob expansion, only the generation of sourcePath in plugin data.

interface IPluginEntry #

Exported from: @documentalist/compiler

Plugins are stored with the regex used to match against file paths.

Properties

pattern
RegExp
plugin
IPlugin<T>

interface IMarkdownPluginOptions #

Exported from: @documentalist/compiler

Properties

navPage
string = "_nav"

Page reference that lists the nav roots.

interface INpmPluginOptions #

Exported from: @documentalist/compiler

Properties

excludeNames
Array<string | RegExp>

Array of patterns to exclude packages by name.

excludePrivate
boolean

Whether to exclude packages marked private.

interface ITypescriptPluginOptions #

Exported from: @documentalist/compiler

Properties

excludeNames
Array<string | RegExp>

Array of patterns (string or RegExp) to exclude members by name. Strings will be converted to regular expressions through string.match(pattern).

Note that excluded members will still be parsed by the compiler, so they can be referenced by other symbols, but they will not appear in the output data.

excludePaths
Array<string | RegExp>

Array of patterns (string or RegExp) to exclude members based on file path. See excludeNames above for usage notes.

gitBranch
string

Specify the branch name to use when generating source file URLs. If omitted, the current commit hash will be used.

see: ITsDocBase.url

includeDeclarations
boolean = false

Enable parsing of .d.ts files.

includeNodeModules
boolean = false

Whether files in node_modules should be included in the TypeScript compilation context. This is disabled by default because it typically results in an explosion of data size due to including all types from all installed packages, the vast majority of which are not useful for documenting your own APIs.

Enable at your own risk, and consider using the excludeNames and excludePaths options above to filter the output data.

includePrivateMembers
boolean = false

Whether private fields should be included in the data. This is disabled by default as private fields typically do not need to be publicly documented.

tsconfigPath
string

Path to tsconfig file.

verbose
boolean = false

If enabled, logs messages and compiler errors to the console. Note that compiler errors are ignored by Typedoc so they do not affect docs generation.

interface IRoute #

Exported from: @documentalist/index.ts

Route

Properties

render
() => string
route
string

type alias StringOrTag #

Exported from: @documentalist/client
StringOrTag
string | ITag

An entry in contents array: either an HTML string or an @tag.