Git Product home page Git Product logo

typedoc-plugin-markdown's People

Contributors

auhau avatar betaorbust avatar boneskull avatar bra1ndump avatar cancerberosgx avatar danieleds avatar edchapel avatar gcharnock avatar github-actions[bot] avatar greenkeeper[bot] avatar hopding avatar jsamr avatar k-yle avatar lorenzolewis avatar lukaswelinder avatar markostanimirovic avatar milocosmopolitan avatar mofnire avatar mongodben avatar mrousavy avatar nilennoct avatar ocavue avatar ozum avatar sangaman avatar tgreyuk avatar trmjoa avatar vinnl avatar wachri avatar wweiss avatar zamiell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

typedoc-plugin-markdown's Issues

exclude

Using --excludePrivate, if none of the private properties have description they are included in generated doc:

OK

--excludePrivate

/**
 * Logger  of data file
 */
private readonly _logger: Logger;
private readonly _option: Logger;

Shows private properties

--excludePrivate

private readonly _logger: Logger;
private readonly _option: Logger;

Formatting of interface generic method is unclear.

I'd be happy to sort this out myself and make a PR, but I'm a bit lost as to what part of the codebase is causing this issue.

The following is related to github MD, I have not tried reproducing this in other styles.

When parsing an interface's method that is generic I get the following:

**reduce**R(reducer: *`function`*, initialReduction?: *`R`*, context?: *`any`*): `R`

The expected output should be something like this:

**reduce**<`R`>(reducer: *`function`*, initialReduction?: *`R`*, context?: *`any`*): `R`

I'd appreciate any input, or at least a nudge in the right direction, thanks.

Handling generic types - again

@tgreyjs Thanks for the last fix but I find another issue in it.

Code:

export class MyFirstClass {
}

export class MySecondClass<T> {
}

export class MyThirdClass {
    constructor(public arg: MyFourthClass<MyFirstClass, MySecondClass<MyFirstClass>>) {
        // do nothing here
    }
}

export class MyFourthClass<K, V> {
}

Actual:
image

Expected:
image

I have updated my repo accordingly.

Properties with multiple allowable types render incorrectly

Issue:

When a property has multiple allowable types, the asterisks that are supposed to italicize the property types have a space between the type and the asterisk. For example: * string | boolean *. When the markdown file is generated, this results in a stray asterisk before the types, and a stray bullet below.

Proposed solution:

When a property can have multiple types, the asterisks should be located immediately next to the types, with no space, like this: *string | boolean*.

The following sample interface would exhibit this behavior:

export interface ISettings {
  aSetting: string | boolean;
}

Which renders the following (broken) markdown:

## Properties

<a id="asetting"></a>

###  aSetting

**● aSetting**: * `boolean` &#124; `string`
*

*Defined in [path/to/file](https://path/to/github/file)*

See the following screenshot:

markdown

Not linking symbol references

I'm using typedoc-plugin-markdown (version 2.1.1) with typedoc version 0.15.0.
Symbol references (double square brackets) are no longer rendering as links. Is there any information I can provide that can help figure out why this is happening?

Thanks for the great work!

cannot ignore destructured assignment

Hi,

I'm not sure if this is related to typedoc-plugin-markdown or typedoc. I can't compare output with bare typedoc, because I cannot see those variables in bare typedoc.

/** @ignore */
const em = chalk.yellow;
/** @ignore */
const { red, green } = chalk;

did not ignore red and green:

Variables

green

green: Chalk & object

Defined in messages.ts:20


red

red: Chalk & object

Defined in messages.ts:20

Error: Missing helper: "relativeURL"

I'm getting this exception when generating documentation with --theme markdown.

/Users/.../node_modules/handlebars/dist/cjs/handlebars/helpers/helper-missing.js:19
      throw new _exception2['default']('Missing helper: "' + arguments[arguments.length - 1].name + '"');
      ^
Error: Missing helper: "relativeURL"
    at DeclarationReflection.<anonymous> (/Users/.../node_modules/handlebars/dist/cjs/handlebars/helpers/helper-missing.js:19:13)
    at eval (eval at createFunctionContext (/Users/.../node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js:254:23), <anonymous>:8:100)
    at Object.prog [as fn] (/Users/.../node_modules/handlebars/dist/cjs/handlebars/runtime.js:221:12)
    at DeclarationReflection.ifDisplayIndexItem (/Users/.../node_modules/typedoc-plugin-markdown/dist/theme/helpers/ifDisplayIndexItem.js:10:21)
    at eval (eval at createFunctionContext (/Users/.../node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js:254:23), <anonymous>:5:116)
    at prog (/Users/.../node_modules/handlebars/dist/cjs/handlebars/runtime.js:221:12)
    at execIteration (/Users/.../node_modules/handlebars/dist/cjs/handlebars/helpers/each.js:51:19)
    at ReflectionGroup.<anonymous> (/Users/.../node_modules/handlebars/dist/cjs/handlebars/helpers/each.js:61:13)
    at eval (eval at createFunctionContext (/Users/.../node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js:254:23), <anonymous>:8:31)
    at Object.prog [as fn] (/Users/.../node_modules/handlebars/dist/cjs/handlebars/runtime.js:221:12)

I'm currently using:

"typescript": "^3.1.3",    
"typedoc": "0.13.0",
"typedoc-plugin-markdown": "1.1.17"

Thanks!

Cannot doc object destructuring

Hi,

I cannot create object destructuring object parameters in doc.

(I shortened for example purposes)

  /**
   * Some desc.
   * @param   value       Indexed value to search for.
   * @param   key         Param description
   * @param   fromIndex   The index etc.
   * @returns The first index of the element in the array; -1 if not found.
   */
  public getIndex(value: any, { key = this.defaultField, fromIndex = 0 }: { key?: keyof I; fromIndex?: number } = {}): number {
    return 1
  }

key and fromIndex is missing in docs.

markdown output:

image

TypeDoc Theme output

image

Kind Regards,

Links not Working when Displayed in Azure DevOps Wiki

So far this has been working well for me, with only one exception. This is the command I am running to generate documentation:

typedoc --theme markdown --namedAnchors --platform docusaurus --out ./docs

In Azure DevOps I have a wiki configured to pull markdown files from code (see this description)

The links that are generated in the wiki (which I believe is just exposing the .MD files,) do not work. They appear to be anchors to areas lower in the page but when you click on them nothing happens.

Here is an example of the URL
_wiki/wikis/admin?pagePath=%2Fmodules%2F_admin_&wikiVersion=GBmaster&pageId=27&anchor=const-admin_list_create_fulfilled

I do not see any errors in the console and the links on the main page (Globals) work when linking to the child MD files.

Is there a workaround for this?

misses class properties

class
`
export abstract class DatabaseProviderBase {

private webSQLBase: any;
private base: SQLiteObject;

constructor() {
   ........
}

/**
 * Создание связи с БД и создание необходимых таблиц в БД.
 *
 * @param {string[]} arrCreateTable
 */
createDB(arrCreateTable: string[], platform, sqlite, ga) {
    ............
}

/**
 * Выполнение запроса к Базе данных
 *
 * @param {string} sql SQL строка
 * @param {any[]} data Данные для запроса
 * @returns {Promise<any>}
 */
executeSql(sql: string, data: any[]): Promise<any> {
   ........
}

/**
 * Преобразование ответа от базы в масив нужного типа
 *
 * @param obj
 * @param {{new(l: any): T}} type
 * @returns {T[]}
 */
getRowsType<T>(obj: any, type: { new (l: any): T; }): T[] {
    .........
}

/**
 * преобразование ответа от базы в масив елементов простого типа(number, string и т.д.)
 *
 * @param obj
 * @returns {T[]}
 */
getRowsSimple<T>(obj: any): T[] {
   ........
}

}
`

generated html
https://yadi.sk/i/E9H3iaRd3SLgJe

generated markdown
https://yadi.sk/i/bnF-xUiS3SLgd6

Not generating anchors for Bitbucket

When using this documentation generator for Bitbucket, it is generating the links, but not the anchor tags for an item that it links to. For example in one of my classes, it's generating the following for the constructor at the top of the file:

* [constructor](handler.md#markdown-header-constructor)

But there is no anchor tag on the actual constructor. The constructor documentation looks like this:

###  constructor

\+ **new Handler**(`controller`: `TController`, `event`: `APIGatewayEvent`): *[Handler](handler.md)*

Defined in handlers/base.handler.ts:14

**Parameters:**

Name | Type |
------ | ------ |
`controller` | `TController` |
`event` | `APIGatewayEvent` |

**Returns:** *[Handler](handler.md)*

In order for the link to work in bitbucket, it should look like this:

### <a name="markdown-header-constructor"></a> constructor

[email protected] strips @example tags from module members

I have some scripts that inject @example tags into my jsdoc with files. Was surprised to find that they get stripped by this plugin:

generated markdown https://github.com/Zemnmez/react-dom-observer/blob/weird-example-stripping/README.md#const-useintersectionobserver
original code https://github.com/Zemnmez/react-dom-observer/blob/weird-example-stripping/src/index.tsx#L254

This seems to be different from a module annotation, where it's instead presented as

**example**

Error: Unknown option `platform`.

Hello! Very useful plugin!
But i have some problem with use them.

function GenDoc(_path) {
	return new Promise((resolve, reject) => {
		src([`./${_path}`])
			.pipe(
				typedoc({
					tsconfig: "./tsconfig.json",
					out: `./docs/${_path}/`,
				        readme: `./${_path}/README.md`,
					name: `Player ${_path} documentation`,
					ignoreCompilerErrors: true,
					version: true,
					excludePrivate: true,
					mode: "file"
				})
			)
			.on("end", () => {
				console.log("[GULP Doc been generated]", _path);
				resolve();
			})
			.on("error", (err) => {
				reject(err);
			})
	})
}

I use this for generate doc with multiply readme.md

api-modules
|--->module1->readme.md
|--->module2->readme.md
ui-modules
|--->module1->readme.md

Function GenDoc i call by async await over for iterator

for (let i = pathToModules.length - 1; i >= 0; i--) {
	await(function () {
		return new Promise(res => {
			const _path = pathToModules[i];
			GenDoc(_path)
				.then(() => {
					console.log(`BUILD DOC ${_path} IS DONE!`);
					res()
				})
				.catch((err) => {
					reject(err)
				})
		})
	})();
}

Run it by one gulp task.
First module generated with success, but second is fail with Error: Unknown option platform.

After minor debug i found that in typedoc-plugin-markdown\dist\index.js condition app.converter.hasComponent('markdown') on second iteration return true, and app.options.addDeclaration not call for "platform", "hideSources" and other, but in Option(typedoc\dist\lib\utils\options\option.js) class declarations property not have this value and (typedoc-plugin-markdown\dist\plugin.js) options.getValue('platform') return error.

9e9c3-clip-44kb

Its my bad or bug?

@param name gone

I'm trying to generate docs to some TS interfaces but the @param name is removed from the markdown.

Input:

interface TestInterface {
    /**
     * Description of property a
     * @param a - Testing a description
     */
    testFunction?: (a: string) => void;
}

Output:

___

### `Optional` testFunction

• **testFunction**? : *function*

Defined in test/src/test.tsx:32

Description of property a

**`param`** Testing a description

#### Type declaration:

▸ (`a`: string): *void*

**Parameters:**

Name | Type |
------ | ------ |
`a` | string |

___

The a property name that was right after @param is gone, am I doing something wrong?

Node v6 support removed?

It appears this commit broke my build, as yarn will now refuse to install the package on node v6:
855342f

Any reason why node 6 isn't supported anymore? Shouldn't this have been a breaking change, semver-wise?

Cannot read property of undefined

Hitting the following issue wile trying to run typedoc

node_modules\typedoc\dist\lib\models\reflections\abstract.js:203
let alias = this.name.replace(/[^a-z0-9]/gi, '_').toLowerCase();
^

TypeError: Cannot read property 'replace' of undefined

Steps to repro

installed typedoc and theis plugin using npm install -g typedoc typedoc-plugin-markdown

now tried to run typedoc with --theme markdown option

Pipe character not escaped

/**
 * Foo method
 * @param bar Some argument with | in description
 */
public foo (bar: number | string): void {
}

Parameter table generated as

| bar | `number` | `string` |  Some argument with | in description |

instead of

| bar | `number` \| `string` |  Some argument with \| in description |

Escape sequence missing for union types and pipe chars in method description.

Version:
[email protected]
[email protected]

Request: Github Wiki Support

Right now my project awesome-querystring (as well as other projects) gets output to a whole slew of files and folders that are by no means GitHub Wiki compatible which expects all files in the root output folder and especially to not start with a _ as those are not displayed as potential pages.

Example of a GitHub wiki files tree for my discord bot project

image

So in short some requirements:

  • Spaces in the file names are replaced with -
  • No leading _, they are the GitHub proprietary files (like the footer and sidebar)
  • Output interfaces, enums, modules etc all to 1 single file otherwise end users are constantly loading files which is extremely bad UX.

In all honesty the ideal scenario I would want to be able to attain with Typedoc and thus this plugin is something like this markdown. Right now I achieve this through JSDoc but you can probably imagine it would be far more proper to use TypeDoc in a TypeScript based project.


google

Searches GoogleCommand - Gets information through Google

Note: prioritizes Knowledge Graphs for better searching

Aliases: search, g

Category: searches

Param Type Description
SearchQuery string

Thing to find on Google

Example

google Pyrrha Nikos

From these document tags:

/**
 * @file Searches GoogleCommand - Gets information through Google
 *
 * Note: prioritizes Knowledge Graphs for better searching
 *
 * **Aliases**: `search`, `g`
 * @module
 * @category searches
 * @name google
 * @example google Pyrrha Nikos
 * @param {string} SearchQuery Thing to find on Google
 */

Optionals are strangely rendered

Hello there, thank you for this plugin. I have run into an issue where optionals of an object type render strangely (missing space between Optional and the object property. As an example:

Input:

export type SomeOptions = {
  aFunction?: () => void
}

Output:

## Type aliases
<a id="someoptions"></a>

###  SomeOptions

**Τ SomeOptions**:  *object* 



#### Type declaration

OptionalaFunction?: `undefined`⎮function

Command run:
typedoc ./src/Class.ts --mdHideSources --out ./docs --options ./config/typedoc.js

Config:

module.exports = {
  mode: 'modules',
  externalPattern: '**/node_modules/*',
  excludeExternals: true,
  excludePrivate: true,
  readme: 'none',
  theme: 'markdown'
}

TypeError: Cannot read property 'find' of undefined

Im getting a TypeError when running ./node_modules/.bin/typedoc --theme markdown --out examples/md-doc ./src/reflect/var-name.ts

Version

{
    "typedoc": "^0.14.2",
    "typedoc-plugin-markdown": "^1.1.21",
    "typescript": "^3.2.2"
}

Output

Loaded plugin ./node_modules/typedoc-plugin-markdown

Using TypeScript 3.2.2 from ./node_modules/typescript/lib
./node_modules/typedoc-plugin-markdown/dist/theme/helpers/getParamatersTableHeaders.js:5
    const hasDefaultValues = parameters.find((param) => {
                                       ^

TypeError: Cannot read property 'find' of undefined
    at ParameterReflection.getParametersTableHeaders (./node_modules/typedoc-plugin-markdown/dist/theme/helpers/getParamatersTableHeaders.js:5:40)
    at eval (eval at createFunctionContext (./node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js:254:23), <anonymous>:5:146)
    at Object.prog [as fn] (./node_modules/handlebars/dist/cjs/handlebars/runtime.js:221:12)
    at ParameterReflection.<anonymous> (./node_modules/handlebars/dist/cjs/handlebars/helpers/if.js:19:22)
    at eval (eval at createFunctionContext (./node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js:254:23), <anonymous>:14:32)
    at prog (./node_modules/handlebars/dist/cjs/handlebars/runtime.js:221:12)
    at execIteration (./node_modules/handlebars/dist/cjs/handlebars/helpers/each.js:51:19)
    at SignatureReflection.<anonymous> (./node_modules/handlebars/dist/cjs/handlebars/helpers/each.js:61:13)
    at eval (eval at createFunctionContext (./node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js:254:23), <anonymous>:6:31)
    at Object.prog [as fn] (./node_modules/handlebars/dist/cjs/handlebars/runtime.js:221:12)

Process finished with exit code 1

var-name.ts

const varExtractor = new RegExp('(return|=>) ([^;]+);?');
export function varName<TResult>(name: () => TResult, opts: {basename: boolean} = { basename: true}) {
    const m = varExtractor.exec(name + '');
    if (m == null) {
        throw new Error("The function does not contain a statement matching 'return variableName;'");
    }
    return !opts.basename ? m[2] : m[2].split('.').pop() + '';
}

Type of this is ParameterReflection in getParamatersTableHeaders when the error occurs.

Request: Single file from multiple file

jsdoc2md optionally produce single markdown page from multiple modules/files by concatenating them. Also let developer use a handlebars template for that single page.

This is super useful to generate a README.md file for npm and github from code automatically.

Below is a simplified example handlebars template I use for that purpose:

<!-- DO NOT EDIT README.md (It will be overridden by README.hbs) -->

# {{changeCase "title" (package "name")}}

<!-- Badges from shield.io -->
> {{package "description"}}
>
> {{#each (package "shields")}}[![{{this.name}}][{{this.name}}]][{{this.name}}-url]{{/each}}

{{#each (package "shields")}}
[{{this.name}}]: {{this.image}}
[{{this.name}}-url]: {{this.url}}
{{/each}}

<!-- START doctoc -->
<!-- END doctoc -->

Some manual content I want to include in my README.

Below main part is added by jsdoc2md

# API
{{>main~}}

All those can be achieved programmatically with typedoc-plugin-markdown too, but it is helpful to have this feature built-in, because npm & github README.md file generation may be used by lots of people.

EDIT:

Why this is useful?

Sometimes, especially for small modules, it's enough to have a single README.md file for the whole documentation, and there is no need to have extra web sites/github pages or wiki pages. For example:

# Install

# Synopsis

# Usage

# API

jsdoc2md generated API comes here.

TypeError: Cannot read property 'replace' of undefined

Receive the following error when running with this theme:

Using TypeScript 2.4.1 from C:\Users\jdimarzio\AppData\Roaming\npm\node_modules\typedoc\node_modules\typescript\lib
C:\Users\jdimarzio\AppData\Roaming\npm\node_modules\typedoc\dist\lib\models\reflections\abstract.js:173
var alias = this.name.replace(/[^a-z0-9]/gi, '_').toLowerCase();
^

TypeError: Cannot read property 'replace' of undefined
at ProjectReflection.Reflection.getAlias (C:\Users\jdimarzio\AppData\Roaming\npm\node_modules\typedoc\dist\lib\models\reflections\abstract.js:173:35)
at Function.DefaultTheme.getUrl (C:\Users\jdimarzio\node_modules\typedoc\dist\lib\output\themes\DefaultTheme.js:196:30)
at Function.DefaultTheme.getUrl (C:\Users\jdimarzio\node_modules\typedoc\dist\lib\output\themes\DefaultTheme.js:199:32)
at Function.MarkdownTheme.buildUrls (C:\Users\jdimarzio\node_modules\typedoc-plugin-markdown\dist\theme\index.js:36:57)
at C:\Users\jdimarzio\node_modules\typedoc-plugin-markdown\dist\theme\index.js:127:31
at Array.forEach ()
at MarkdownTheme.getUrls (C:\Users\jdimarzio\node_modules\typedoc-plugin-markdown\dist\theme\index.js:126:33)
at Renderer.render (C:\Users\jdimarzio\AppData\Roaming\npm\node_modules\typedoc\dist\lib\output\renderer.js:45:34)
at CliApplication.Application.generateDocs (C:\Users\jdimarzio\AppData\Roaming\npm\node_modules\typedoc\dist\lib\application.js:100:23)
at CliApplication.bootstrap (C:\Users\jdimarzio\AppData\Roaming\npm\node_modules\typedoc\dist\lib\cli.js:62:26)

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .travis.yml
  • The new Node.js version is in-range for the engines in 1 of your package.json files, so that was left alone

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Union type function parameters don't render correctly in Docusaurus

First off, thanks to everybody collaborating on this TypeDoc theme! It's fantastic! 🎉

I'm using this theme to generate API docs in markdown for https://pdf-lib.js.org/docs/api/. These markdown files are then processed by Docusaurus. This works great, except for one small issue I discovered. I'll illustrate the problem with an example:

Here's a simple function with a single parameter typed as a union:

export function foo(a: string | Uint8Array | ArrayBuffer): void {
  console.log(a);
}

And here's how this function's signature is rendered in Docusaurus:
Screen Shot 2019-07-21 at 7 00 56 PM

As you can see, the | separating the members of the union in the parameters table are not being escaped correctly by Docusaurus. This is due to how Docusaurus' markdown engine parses markdown tables:

Instead of escaping the pipe with \|, we can replace it with &#124;. Here's what the function's signature looks like when rendered in Docusaurus after this change:
Screen Shot 2019-07-21 at 7 01 25 PM

I'll create a PR with this fix shortly.

Parameter table render problem when parameter has multiple types

If you have a function or method with a parameter with multiple types like

function doOtherThings(value: string | number | SubClassA): void {} 

the table isn't rendered correct:

Param Type Description
value string
number
ElementFinder
A description

The output is:

| Param | Type | Description |
| ------ | ------ | ------ |
| value | `string` |
`number` |
`ElementFinder`
 |  A description |

I'm already working on a PR.

mdPagesSourcePath cannot accessed from typedoc-webpack-plugin

i am use typedoc-webpack-plugin like this:

  var typeDocPlugin = new TypedocWebpackPlugin(
            {
               mdPagesSourcePath: './backend/test-page',
              /// other settings            
            }
        );

and get this error:
Error: Failed to get page collection. Error: Failed to get pages source path from options. Error: Pages source path must be specified.

It is possible to fix and use plugins together?

Cannot read property 'shortText' of undefined

I got following error using 2.0.0.

Since error messages does not indicate where the problem is in my source files, I uploaded my project which produces error (it's open source) here: https://we.tl/t-SmU4D0u44Y

.../markdown/dist/theme/helpers/parameter-table.js:26
      if (parameter.comment.shortText) {
                            ^

TypeError: Cannot read property 'shortText' of undefined
    at .../node_modules/typedoc-plugin-markdown/dist/theme/helpers/parameter-table.js:26:29
    at Array.map (<anonymous>)
    at Array.parameterTable (.../node_modules/typedoc-plugin-markdown/dist/theme/helpers/parameter-table.js:18:21)
...

After I changed if(parameter.comment.shortText) and if (parameter.comment.text) in dist/theme/helpers/parameter-table.js to if(parameter && parameter.comment.shortText) and if (parameter && parameter.comment.text), I got

.../markdown/dist/theme/helpers/parameter-table.js:26
      if (parameter && parameter.comment.shortText) {
                                         ^

TypeError: Cannot read property 'shortText' of undefined
    at .../node_modules/typedoc-plugin-markdown/dist/theme/helpers/parameter-table.js:26:42
    at Array.map (<anonymous>)
    at Array.parameterTable (.../node_modules/typedoc-plugin-markdown/dist/theme/helpers/parameter-table.js:18:21)
    at eval (eval at createFunctionContext (.../node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js:257:23), <anonymous>:6:197)

[Bug?] Handling generic types

Hello,

There seems a bug when this plugin handles generic types such as MyClass<T>.

I have created a repository for your reference here.

Code:

export class MyFirstClass {
}

export class MySecondClass<T> {
}

export class MyThirdClass {
    constructor(public arg: Array<MySecondClass<MyFirstClass>>) {
        // do nothing here
    }
}

md file generated (or you can see it here):
image

You can see that type of arg is rendered incorrectly.

Here's the html result by typedoc without plugin:
image

It seems that this should be the correct result.

Thanks,
KidyovrS

Index not displayed when a module does not contain classes and enums.

This only happens with --mdEngine gitbook.

Source:

export interface IMyInterface {
}

export const MyVariable: string = "HelloWorld";

Actual:

# Variables

<a id="myvariable"></a>

## `<Const>` MyVariable

**● MyVariable**: *`string`* = "HelloWorld"

___

Expected:

# Index

### Interfaces

* [IMyInterface](../interfaces/_index_.imyinterface.md)

### Variables

* [MyVariable](_index_.md#myvariable)

---

# Variables

<a id="myvariable"></a>

## `<Const>` MyVariable

**● MyVariable**: *`string`* = "HelloWorld"

___

It's fine to hide index if the module only contains variables/functions, since they're directly documented in the module page. However I suppose interfaces should be treated the same as classes and enums.

basic example?

Hello, I'm trying to put together a basic example using the docusaurus workflow.

But something's not working with the typedoc MD generation, I get an index.md created, but no classes/enums/interfaces, and it doesn't seem to integrate properly with sidebars.json

what gets added to sidebars.json is:

  "undefined": {
    "Introduction": [
      "index"
    ],
    "External Modules": [
      "",
      "",
      "",
      "",
      "",
      ""
    ]
  }

and I'm not sure where the problem would be, maybe one of the following?:

  • my code is missing something expected
  • my typescript code have some definition breaking the typedoc-plugin-markdown
  • wrong version of docusaurus
  • misconfiguration of typedoc
  • not working on windows
  • something else?

So, having a basic example that I can get working and then customize seems neccesary. My example is pretty basic so far. I can post the code if needed, but probably quicker if a reference example can be created.

ENOENT on an unexisting partial

You're quick. Almost there. :-)

Error: ENOENT: no such file or directory, open 'C:\path\to\node_modules\typedoc-plugin-markdown\dist\theme\partials\member.objectliteral.hbs'
    at Error (native)
    at Object.fs.openSync (fs.js:640:18)
    at Object.fs.readFileSync (fs.js:508:33)
    at templateToString (C:\path\to\node_modules\typedoc-plugin-markdown\dist\theme\utils.js:13:15)
    at Object.compileTemplate (C:\path\to\node_modules\typedoc-plugin-markdown\dist\theme\utils.js:7:18)
    at DeclarationReflection.compileMember (C:\path\to\node_modules\typedoc-plugin-markdown\dist\theme\helpers\compileMember.js:15:26)
    at eval (eval at createFunctionContext (C:\path\to\node_modules\handlebars\dist\cjs\handlebars\compiler\javascript-compiler.js:254:23), <anonymous>:5:106)
    at Object.prog [as inverse] (C:\path\to\node_modules\handlebars\dist\cjs\handlebars\runtime.js:221:12)
    at DeclarationReflection.<anonymous> (C:\path\to\node_modules\handlebars\dist\cjs\handlebars\helpers\if.js:17:22)
    at DeclarationReflection.<anonymous> (C:\path\to\node_modules\handlebars\dist\cjs\handlebars\helpers\if.js:24:35)

Doesn't work with typedoc 0.14.0

Updating typedoc to 0.14.0 cause following error with this plugin. That's probably connected to typescript upgrade.

TypeError: Class constructor ConverterComponent cannot be invoked without 'new'
    at new MarkdownPlugin (/home/user/something/node_modules/typedoc-plugin-markdown/dist/plugin.js:31:42)
    at Converter.addComponent (/home/user/something/node_modules/typedoc/dist/lib/utils/component.js:123:19)
    at Converter.addComponent (/home/user/something/node_modules/typedoc/dist/lib/converter/converter.js:28:33)
    at module.exports (/home/user/something/node_modules/typedoc-plugin-markdown/dist/index.js:36:19)

Option to exclude inherited members

I am specifically trying to avoid polluting the docs with unused react.js lifecycle methods, eg UNSAFE_componentWillMount. The themes included with typedoc have a filter built in to the UI to show / hide this.

screen shot 2019-02-05 at 3 10 51 pm

Possible dangerous situation

Hi there,
I wanted to use this to generate a documented README in my repo

I ran

typedoc --theme markdown --out .

This actually blew away the whole directory which was kind of surprising

__namedParameters support

Currently, if a function accept named parameters, the documentation that is generated does include any documentation the named parameters like how it is with the default theme. Would be nice to include documentation of those parameters as well.

@ sign in title

Hi,

If node module name contains username such as @someuser/module-name, vuepress and docusaurus (maybe others too) generated index.md and README.md meta-data causes YAML parser to throw error when used with vuepress.

---
id: README
title: @someuser/module-name
sidebar_label: Globals
---

## Variables
YAMLException: end of the stream or a document separator is expected at line 2, column 8:
    title: @someuser/module-name
           ^
    at generateError (.../node_modules/js-yaml/lib/js-yaml/loader.js:167:10)
    at throwError (.../node_modules/js-yaml/lib/js-yaml/loader.js:173:9)
    at readDocument (.../node_modules/js-yaml/lib/js-yaml/loader.js:1539:5)

Kind regards,

Support for categorization

Could we please have some categorization support as well in this theme?

Ex:

@category abc
function abc() {
}

@category bcd()
function bcd() {
}

this ts should create different sections in the output md.

Error when all things are hidden in a module.

If all things (functions, classes, interfaces, enums, variables, etc.) are marked hidden using

/**
 * @hidden
 */

in a module, then error would be thrown:

C:\workdir\typedoc-markdown-sample>node_modules\.bin\typedoc --theme markdown --out out_markdown
Loaded plugin typedoc-plugin-markdown

Using TypeScript 2.7.2 from C:\workdir\typedoc-markdown-sample\node_modules\typescript\lib
C:\workdir\typedoc-markdown-sample\node_modules\typedoc-plugin-markdown\dist\theme\helpers\ifDisplayIndex.js:8
    var classModule = member.children ? member.children[0].kind === index_1.ReflectionKind.Class : false;
                                                           ^

TypeError: Cannot read property 'kind' of undefined
    at DeclarationReflection.ifDisplayIndex (C:\workdir\typedoc-markdown-sample\node_modules\typedoc-plugin-markdown\dist\theme\helpers\ifDisplayIndex.js:8:60)
    at eval (eval at createFunctionContext (C:\workdir\typedoc-markdown-sample\node_modules\handlebars\dist\cjs\handlebars\compiler\javascript-compiler.js:254:23), <anonymous>:5:108)
    at prog (C:\workdir\typedoc-markdown-sample\node_modules\handlebars\dist\cjs\handlebars\runtime.js:221:12)
    at PageEvent.<anonymous> (C:\workdir\typedoc-markdown-sample\node_modules\handlebars\dist\cjs\handlebars\helpers\with.js:22:14)
    at Object.eval [as main] (eval at createFunctionContext (C:\workdir\typedoc-markdown-sample\node_modules\handlebars\dist\cjs\handlebars\compiler\javascript-compiler.js:254:23), <anonymous>:17:34)
    at main (C:\workdir\typedoc-markdown-sample\node_modules\handlebars\dist\cjs\handlebars\runtime.js:175:32)
    at PageEvent.ret (C:\workdir\typedoc-markdown-sample\node_modules\handlebars\dist\cjs\handlebars\runtime.js:178:12)
    at PageEvent.ret [as template] (C:\workdir\typedoc-markdown-sample\node_modules\handlebars\dist\cjs\handlebars\compiler\compiler.js:526:21)
    at Renderer.renderDocument (C:\workdir\typedoc-markdown-sample\node_modules\typedoc\dist\lib\output\renderer.js:65:30)
    at C:\workdir\typedoc-markdown-sample\node_modules\typedoc\dist\lib\output\renderer.js:53:23

Guess member.children is an empty array here.

Plugin already loaded error(s).

I'm not sure whether this is a bug with typedoc or this plugin.

const app = new typedoc.Application({ ... });
app.generateDocs(src, out);

// TypeDoc will print a stack trace saying that the plugin is already loaded
app.generateDocs(src2, out2);

console.log(app.hasErrors()); // true

The same thing happens when using two application instances.
Using app.converter.hasComponent('markdown') to check for this may be a fix.

Remove readme.md link at top

Can we remove the link to readme.md on top of the file trought and option like --hideReadme, something like that?

Code block must begin with new line

/**
 * Some deprecation
 * @deprecated
 * ```typescript
 * somethingElse();
 * ```
 */
export function foo () : void {
}

is generated as

Some deprecation
*__deprecated__*: ```typescript
somethingElse();
```

**Returns:** `void`

and rendered as


Some deprecation
deprecated: ```typescript
somethingElse();

**Returns:** `void`

Instead a line break must be inserted before code block:

Some deprecation
*__deprecated__*: 
```typescript
somethingElse();
```

**Returns:** `void`

to render correctly as


Some deprecation
deprecated:

somethingElse();

Returns: void

Links not parsed within tags

/**
 * bar method.
 *
 * Doc outside tag
 * - Line 1 [[Option]]
 * - Line 2 [[Option]]
 *
 * @returns Doc inside tag
 * - Line 1 [[Option]]
 * - Line 2 [[Option]]
 */
function bar (o: Option): void {
}

/** Option for bar() */
type Option = 'One' | 'Two';

[[Option]] links within the returns tag are left unparsed.

Version: 0.14.2

Invalid Meta Data

Hi,

After I updated to latest version

/src/lib/theme/helpers/metadata.ts line 13

const md = `---
id: ${getId(this)}
title: ${getReflectionTitle(this)}
sidebar_label: ${getLabel(this)}
---\n`;

produces below meta data part, which is invalid because of title: Class: DataFile

---
id: datafile
title: Class: DataFile
sidebar_label: DataFile
---

Kind regards,

how to use typedoc-markdown with github

Hey guys!
This repo is awesome! :)
Have one question about generating README for f.e. github with your plugin...

I have README file in the project root, and when i generate docs via typedoc it generates new README which contains data from root's README (which is fine), and api docs (which is also fine). But github takes that readme from root as main by default, so there is no point to keep updated README in docs...

Question is - can i just generate api docs and then manually add link to my root README (this is a preferable variant) OR somehow generate final README (api + manual docs) for github ?

exclude options

Hello, cool project! I'm super glad this is happening :)

I gave it a try and the first thing I want to do is exclude some stuff
https://github.com/TypeStrong/typedoc#source-file-handling

--excludeExternals
Prevent externally resolved TypeScript files from being documented.

--excludePrivate
Prevent private members from being included in the generated documentation.

Do the main options get passed to the markdown plugin?

Double Square Brackets Not Rendered as Link

Wonderful plugin that has finally gotten me to start using typedoc -- thanks!

I am having an issue where it does not appear to render [[DoubleBracket]] in typedoc comments as links to the contained symbol. The typedoc doccomments specify ...

Additionally you can link to other classes, members or functions using double square brackets.

... and this works in my project if I render to the default template. However the markdown template renders it as plain text.

If you would like a reproducible example, I'd be happy to provide.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.