https://github.com/hideoo/typedown
Visual Studio Code extension - Quickly export your TypeScript definitions to Markdown
https://github.com/hideoo/typedown
definition export extension markdown typescript vscode
Last synced: about 1 year ago
JSON representation
Visual Studio Code extension - Quickly export your TypeScript definitions to Markdown
- Host: GitHub
- URL: https://github.com/hideoo/typedown
- Owner: HiDeoo
- License: mit
- Created: 2021-09-05T06:40:27.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-03-20T12:24:10.000Z (about 4 years ago)
- Last Synced: 2025-03-31T18:07:18.811Z (about 1 year ago)
- Topics: definition, export, extension, markdown, typescript, vscode
- Language: TypeScript
- Homepage: https://marketplace.visualstudio.com/items?itemName=hideoo.typedown
- Size: 2.3 MB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
Typedown
## Motivations
I often need to convert TypeScript definitions to Markdown to include them in a `README` file, discuss them in a GitHub issue or pull request, etc. so I decided to build a quick way to select in a custom Visual Studio Code editor various definitions from either a file or folder from a TypeScript project and export them to my clipboard in Markdown.
For more advanced use cases, you may want to check other solutions like [TypeDoc](https://typedoc.org) (used internally).
## Usage
You can export TypeScript definitions from either a file or a folder by invoking the associated Typedown command from the Visual Studio Code Command Palette (⌘ + ⇧ + P on macOS or Ctrl + ⇧ + P on Windows & Linux by default):
- **`Typedown: File Definitions to Markdown`** for a file.
- **`Typedown: Folder Definitions to Markdown`** for a folder.
The extension will collect your exported TypeScript definitions and present them to you in a custom Visual Studio Code editor fitting your theme where you will be able to select which definitions to export to Markdown. You can also select the heading level to use for the definition names.
When done, press the **`Export`** button to export the selected definitions to your clipboard in Markdown.
## Definitions
Currently, only TypeScript [interfaces](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#interfaces) & [type aliases](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#type-aliases) exported from your code are converted to Markdown.
Some comments and JSDoc tags in your code can also be used when exporting your definitions to infer a description, a default value, etc.
For example, imagine the following interface:
```typescript
/**
* A round plane figure whose boundary consists of points equidistant from a fixed point.
*/
export interface Circle extends Shape {
kind: 'circle'
/**
* In pixels.
* @default 10
*/
radius?: number
}
```
The generated Markdown code is:
```markdown
# Circle
A round plane figure whose boundary consists of points equidistant from a fixed point.
| Name | Description | Type | Optional | Default value |
| ------ | ----------- | ---------- | :------: | ------------- |
| kind | | `'circle'` | | |
| radius | In pixels. | `number` | ✓ | 10 |
```
The rendered Markdown for this interface is:
> # Circle
>
> A round plane figure whose boundary consists of points equidistant from a fixed point.
>
> | Name | Description | Type | Optional | Default value |
> | ------ | ----------- | ---------- | :------: | ------------- |
> | kind | | `'circle'` | | |
> | radius | In pixels. | `number` | ✓ | 10 |
## License
Licensed under the MIT License, Copyright © HiDeoo.
See [LICENSE](https://github.com/HiDeoo/Typedown/blob/main/LICENSE.md) for more information.