Skip to content

Commit

Permalink
chore: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Feb 6, 2024
1 parent f8ee292 commit 957c995
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ Your automated markdown maintainer!

## Usage

Automd scans for the `<!-- AUTOMD_START --> ... <!-- AUTOMD_END -->` comments within the markdown document and update their contents using generators.
Automd scans for the annotation comments within the markdown document and updates their contents using built-in generators.

The syntax is like this:

```md
<!-- AUTOMD_START generator="<generator name>" [... generator args] -->
<!-- AUTOMD_START generator="jsdocs" [...args] -->

...

Expand All @@ -29,42 +29,45 @@ The syntax is like this:

### Using CLI

Easiest way to use automd, is to use the CLI. You can install automd or run `npx automd` in your project.

By default, `README.md` file in current working directory will be checked.

You can use `--dir` and `--file` arguments to customize default beavior to operate on any other markdown file.
The easiest way to use automd is to use the CLI. You can install automd and add it to the `build` or `release` command in `package.json` or directly run `npx automd` in your project.

```sh
npx automd@latest
```

By default, the `README.md` file in the current working directory will be used as the target.

You can use `--dir` and `--file` arguments to customize the default behavior to operate on any other markdown file.

### Programmatic API

[WIP]

## Generators

There are several available generators for automd each supporting different aguments. See [issues](https://github.com/unjs/automd/issues?q=is%3Aopen+is%3Aissue+label%3Agenerator) for proposed generators and feel free to suggest any generator ideas to be included!
There are several available generators for automd each supporting different arguments.

See [open issues](https://github.com/unjs/automd/issues?q=is%3Aopen+is%3Aissue+label%3Agenerator) for proposed generators and feel free to suggest any generator ideas to be included!

### `jsdocs` Generator

jsdocs generator can automatically read through your code and extract documentation of function exports leveraging JSDocs and TypeScript hints.
jsdocs generator can automatically read through your code and extract and sync documentation of function exports leveraging JSDocs and TypeScript hints.

Internally it uses [untyped](https://untyped.unjs.io/) and [jiti](https://github.com/unjs/jiti) loader for JSDocs parsing and TypeScript support.

#### Usage

```md
## Utils

<!-- AUTOMD_START generator="jsdocs" src="./src/index" -->

...

<!-- AUTOMD_END -->
```

(make sure to have some utility exports in `src/index.ts` annotated with JSDocs.)

#### Example Output
**Example Output:**

## Utils

Expand All @@ -81,11 +84,11 @@ Internally it uses [untyped](https://untyped.unjs.io/) and [jiti](https://github

<!-- AUTOMD_END -->

### Args
### Args supported for `jsdocs`

- `src`: Path to the source file. The default is `./src/index` and can be omitted.
- `headingLevel`: Nested level for markdown group headings (default is `2` => `##`). Note: Each function uses `headingLevel+1` for title in nested levels.
- `group`: Only render function exportes anotated with `@group name`. By default there is no group filter. Value can be an string or array of strings.
- `headingLevel`: Nested level for markdown group headings (default is `2` => `##`). Note: Each function uses `headingLevel+1` for the title in nested levels.
- `group`: Only render function exportes annotated with `@group name`. By default, there is no group filter. Value can be a string or array of strings.

## Development

Expand Down

0 comments on commit 957c995

Please sign in to comment.