Closed jackens closed 2 years ago
Hi. This plugin merges modules. I haven't used TypeDoc to document JS files yet. Didn't know that works.
I'm a bit confused by your example. Where is your namespace and interface? What would be your expected output?
TypeScript works quite well with JavaScript files, and if they have JSDoc blocks in addition, it generates .d.ts files that TypeDoc can turn into quite nice documentation :)
I would expect Type3 to be in README.md, just like Type4 (they're actually the same definitions). Likewise with Type5, which should be merged into README.md.
The plugin should merge the contents of modules and interfaces directories.
README.md
:
# issue
Some module.
## Namespaces
- [Type5](modules/Type5.md)
## Interfaces
- [Type3](interfaces/Type3.md)
## Type aliases
### Type1
Ƭ **Type1**<\>: <\>(`one`: `number`, `two`: `number`) => `number`
#### Type declaration
▸ <\>(`one`, `two`): `number`
##### Parameters
| Name | Type |
|:------|:---------|
| `one` | `number` |
| `two` | `number` |
##### Returns
`number`
___
### Type2
Ƭ **Type2**<\>: (`one`: `number`, `two`: `number`) => `number`
#### Type declaration
▸ (`one`, `two`): `number`
Some type 2.
##### Parameters
| Name | Type |
|:------|:---------|
| `one` | `number` |
| `two` | `number` |
##### Returns
`number`
#### Defined in
file.js:19
___
### Type4
Ƭ **Type4**<\>: `Object`
Some type 4.
#### Type declaration
| Name | Type |
|:------|:---------|
| `one` | `number` |
| `two` | `number` |
#### Defined in
file.js:38
## Variables
### Type5
• `Const` **Type5**: typeof [`Type5`](README.md#type5) = `{}`
Some type 5.
This block will be placed in the `modules/Type5.md` file
instead of the `README.md` file.
#### Defined in
file.js:49
interfaces/Type3.md
:
# Interface: Type3<\>
Some type 3.
## Properties
### one
• **one**: `number`
property #1
#### Defined in
file.js:30
___
### two
• **two**: `number`
property #2
#### Defined in
file.js:31
modules/Type5.md
:
# Namespace: Type5
## Variables
### answer
• **answer**: `number`
## Functions
### id
▸ **id**(`n`): `number`
#### Parameters
| Name | Type |
|:-----|:---------|
| `n` | `number` |
#### Returns
`number`
#### Defined in
file.js:56
I'm not sure I can follow you there.
This plugin is meant to remove the extra module layer that TypeDoc creates. A module is normally a file which contains something that you want to have documented. The plugin moves all the documented things into the project but doesn't move all documented things into one file which you seem to be looking for here.
I assumed that the plugin that merges the content of modules should also merge the content of a single module/file (src/file.js from my example). Feel free to close the issue if I am wrong. Thank you for your replies!
So you want the documentation of several types to be in one file and not one file per type, right? If so then this is not the goal of this plugin.
package.json
:typedoc.json
:tsconfig.json
:src/file.js
:After running
and
we got