https://github.com/twlite/node-deno_doc
WASM bindings to deno_doc for Node.js
https://github.com/twlite/node-deno_doc
deno docgen documentation generator javascript jsdoc node typedoc typescript url
Last synced: 9 months ago
JSON representation
WASM bindings to deno_doc for Node.js
- Host: GitHub
- URL: https://github.com/twlite/node-deno_doc
- Owner: twlite
- License: other
- Archived: true
- Created: 2022-04-29T14:12:14.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-04-29T14:56:52.000Z (about 4 years ago)
- Last Synced: 2024-09-26T07:02:13.149Z (almost 2 years ago)
- Topics: deno, docgen, documentation, generator, javascript, jsdoc, node, typedoc, typescript, url
- Language: JavaScript
- Homepage: https://npm.im/deno_doc
- Size: 1020 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `deno_doc`
A **[Deno Doc](https://github.com/denoland/deno_doc)** port for Node.js
# Features
* Asynchronous
* Supports both JavaScript and TypeScript
* Generates documentation from remote url or file path
* ESM & CJS supported
# Installation
```sh
# npm
$ npm install --save deno_doc
# Yarn
$ yarn add deno_doc
```
# Example Usage
```js
// ES Modules
import { doc } from "deno_doc";
const colorsDoc = await doc("https://deno.land/std/fmt/colors.ts");
for (const node of colorsDoc) {
console.log(`name: ${node.name} kind: ${node.kind}`);
}
// CommonJS
const { doc } = require("deno_doc");
const colorsDoc = await doc("https://deno.land/std/fmt/colors.ts");
for (const node of colorsDoc) {
console.log(`name: ${node.name} kind: ${node.kind}`);
}
```
# API
## `doc()`
The `doc()` function takes a string URL module specifier and potentially some options, and asynchronously resolves with an array of documentation nodes, which represent the surface API of the module.
A minimal example of using `doc()` and printing out some information about a function:
```js
import { doc } from "deno_doc";
const colorsDoc = await doc("https://deno.land/std/fmt/colors.ts");
for (const node of colorsDoc) {
console.log(`name: ${node.name} kind: ${node.kind}`);
}
```
The `doc()` function needs a way to retrieve modules, and by default uses a `load()` function provided by a partial implementation of `deno_graph` which uses `fetch()` for remote modules and `fs.readFile()` for local modules.