Skip to content

Commit 8801856

Browse files
committed
chore: initiate docs
1 parent 7e91ba4 commit 8801856

File tree

14 files changed

+342
-194
lines changed

14 files changed

+342
-194
lines changed

README.md

Lines changed: 1 addition & 194 deletions
Original file line numberDiff line numberDiff line change
@@ -9,207 +9,14 @@
99

1010
Your automated markdown maintainer!
1111

12-
> [!NOTE]
13-
> This project is in the early stages and under development.
12+
📚 Read more in the [Documentation](https://automd.unjs.io)
1413

1514
## 🦴 Used by
1615

1716
- [unjs/ufo](https://github.com/unjs/ufo)
1817
- [unjs/omark](https://github.com/unjs/omark)
1918
- [unjs/nypm](https://github.com/unjs/nypm)
2019

21-
## Usage
22-
23-
Automd scans for the annotation comments within the markdown document and updates their contents using built-in generators.
24-
25-
The syntax is like this:
26-
27-
<!-- automd:generator [...args] -->
28-
<!-- /automd -->
29-
30-
### Using CLI
31-
32-
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.
33-
34-
```sh
35-
npx automd@latest
36-
```
37-
38-
By default, the `README.md` file in the current working directory will be used as the target.
39-
40-
You can use `--dir` and `--file` arguments to customize the default behavior to operate on any other markdown file.
41-
42-
### Configuration
43-
44-
You can specify configuration in `.automdrc` or `automd.config` (`js`, `ts`, `mjs`, `cjs` or `json` format) (powered by [unjs/c12](https://c12.unjs.io)).
45-
46-
Example: `automd.config.js`
47-
48-
```ts
49-
/** @type {import("automd").Config} */
50-
export default {
51-
file: "DOCS.md",
52-
};
53-
```
54-
55-
#### Config
56-
57-
- `dir`: Working directory (defaults to the current working directory).
58-
- You can use `--dir` to override with CLI.
59-
- `file`: The markdown file name or path (relative to `dir`).
60-
- You can use `--file` to override with CLI.
61-
- `generators`: A map of generator names to custom generators.
62-
- You can use `automd.config` to specify them.
63-
64-
### Programmatic API
65-
66-
[WIP]
67-
68-
## Generators
69-
70-
There are several available generators for automd each supporting different arguments.
71-
72-
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!
73-
74-
### `jsdocs`
75-
76-
The `jsdocs` generator can automatically read through your code and extract and sync documentation of function exports leveraging JSDocs and TypeScript hints.
77-
78-
Internally it uses [untyped](https://untyped.unjs.io/) and [jiti](https://github.com/unjs/jiti) loader for JSDocs parsing and TypeScript support.
79-
80-
#### Usage
81-
82-
<!-- automd:jsdocs src="./src/index" -->
83-
<!-- /automd -->
84-
85-
> [!NOTE]
86-
> Make sure you have some utility exports in `src/index.ts` annotated with JSDocs.
87-
88-
**Updated Result:**
89-
90-
<!-- automd:jsdocs src="./src/index" -->
91-
92-
### `add(a, b)`
93-
94-
Adds two numbers together.
95-
96-
**Example:**
97-
```js
98-
add(1, 2); // 3
99-
```
100-
101-
<!-- /automd -->
102-
103-
#### Arguments
104-
105-
- `src`: Path to the source file. The default is `./src/index` and can be omitted.
106-
- `headingLevel`: Nested level for markdown group headings (default is `2` => `##`). Note: Each function uses `headingLevel+1` for the title in nested levels.
107-
- `group`: Only render function exports annotated with `@group name`. By default, there is no group filter. Value can be a string or an array of strings.
108-
109-
### `pm-install|pm-i`
110-
111-
The `pm-install|pm-i` generator generates installation commands for several JavaScript package managers.
112-
113-
#### Usage
114-
115-
<!-- automd:pm-install name=package-name dev -->
116-
<!-- /automd -->
117-
118-
**Updated Result:**
119-
120-
<!-- automd:pm-install name=package-name dev -->
121-
122-
```sh
123-
# ✨ Auto-detect
124-
npx nypm i -D package-name
125-
126-
# npm
127-
npm install -D package-name
128-
129-
# yarn
130-
yarn add -D package-name
131-
132-
# pnpm
133-
pnpm install -D package-name
134-
135-
# bun
136-
bun install -D package-name
137-
```
138-
139-
<!-- /automd -->
140-
141-
#### Arguments
142-
143-
- `name`: The package name (by default tries to read from the `name` field in `package.json`).
144-
- `dev`: Install as a dev dependency (defaults to `false`).
145-
- `separate`: Separate code blocks for each package manager (defaults to `false`).
146-
- `auto`: Auto-detect package manager using [unjs/nypm](https://github.com/unjs/nypm#-nypm) (defaults to `true`).
147-
148-
### `pm-x`
149-
150-
The `pm-x` generator generates commands for running/executing a package through JavaScript package managers.
151-
152-
#### Usage
153-
154-
<!-- automd:pm-x name="package-name" args="[files] <flags>" -->
155-
<!-- /automd -->
156-
157-
**Updated Result:**
158-
159-
<!-- automd:pm-x name="package-name" args="[files] <flags>" -->
160-
161-
```sh
162-
# npm
163-
npx package-name@latest [files] <flags>
164-
165-
# pnpm
166-
pnpm dlx package-name@latest [files] <flags>
167-
168-
# bun
169-
bunx package-name@latest [files] <flags>
170-
```
171-
172-
<!-- /automd -->
173-
174-
#### Arguments
175-
176-
- `name`: The package name (by default tries to read from the `name` field in `package.json`).
177-
- `separate`: Separate code blocks for each package manager (defaults to `false`).
178-
- `args`: An additional string appended at the end of each command suggesting arguments to be used with the program. (defaults to `""`).
179-
180-
### `badges`
181-
182-
The `badges` generator generates badges for the latest npm version, npm download statistics, code coverage, and bundle size.
183-
184-
#### Usage
185-
186-
<!-- automd:badges color=yellow name=defu codecov bundlephobia -->
187-
<!-- /automd -->
188-
189-
**Updated Result:**
190-
191-
<!-- automd:badges color=yellow name=defu codecov bundlephobia -->
192-
193-
[![npm version](https://flat.badgen.net/npm/v/defu?color=yellow)](https://npmjs.com/package/defu)
194-
[![npm downloads](https://flat.badgen.net/npm/dm/defu?color=yellow)](https://npmjs.com/package/defu)
195-
[![bundle size](https://flat.badgen.net/bundlephobia/minzip/defu?color=yellow)](https://bundlephobia.com/package/defu)
196-
[![codecov](https://flat.badgen.net/codecov/c/github/unjs/automd?color=yellow)](https://codecov.io/gh/unjs/automd)
197-
198-
<!-- /automd -->
199-
200-
#### Arguments
201-
202-
- `name`: The npm package name. By default tries to infer from `package.json`.
203-
- `github`: Github repository name. By default tries to infer from `package.json`.
204-
- `bundlephobia`: Show [Bundlephobia](https://bundlephobia.com/) badge (requires `name`).
205-
- `codecov`: Enable [Codecov](https://codecov.io) badge (requires `github`).
206-
- `no-npmDownloads`: Hide npm downloads badge.
207-
- `no-npmVersion`: Hide npm version badge.
208-
- `provider`: Can be one of `shields` (for [shields.io](https://shields.io/)) or `badgen` / `badgenClassic` (for [badgen.net](https://badgen.net/)). Default is `badgen`.
209-
210-
> [!TIP]
211-
> You can use additional args `color`, `labelColor` to customize style. For provider specific params, use `styleParams`.
212-
21320
## Development
21421

21522
- Clone this repository

docs/.docs/public/icon.svg

Lines changed: 82 additions & 0 deletions
Loading

docs/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
.nuxt
3+
.output
4+
dist

docs/1.guide/1.index.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Getting Started
2+
3+
Automd scans for the annotation comments within the markdown document and updates their contents using built-in generators.
4+
5+
The syntax is like this:
6+
7+
```markdown
8+
<!-- automd:generator [...args] -->
9+
<!-- /automd -->
10+
```
11+
12+
> [!NOTE]
13+
> This project is in the early stages and under development.
14+
15+
## Using CLI
16+
17+
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.
18+
19+
```sh
20+
npx automd@latest
21+
```
22+
23+
By default, the `README.md` file in the current working directory will be used as the target.
24+
25+
You can use `--dir` and `--file` arguments to customize the default behavior to operate on any other markdown file.

docs/1.guide/2.config.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Configuration
2+
3+
You can specify custom configuration using `.automdrc` or `automd.config` (with `.ts`, `.mjs`, `.json`, ... powered by [unjs/c12](https://c12.unjs.io))
4+
5+
## Syntax
6+
7+
**Example:** `.automdrc`
8+
9+
```ini
10+
file=DOCS.md
11+
```
12+
13+
**Example:** `automd.config.js`
14+
15+
```ts
16+
/** @type {import("automd").Config} */
17+
export default {
18+
file: "DOCS.md",
19+
};
20+
```
21+
22+
## Available Configs
23+
24+
### `dir`
25+
26+
- Type: `string`
27+
- Default: current working directory
28+
29+
Working directory where paths are resolved from.
30+
31+
> [!TIP]
32+
> You can use `--dir` to override with CLI.
33+
34+
### `file`
35+
36+
- Type: `string`
37+
- Default: `README.md`
38+
39+
The markdown file name or path (relative to `dir`).
40+
41+
> [!TIP]
42+
> You can use `--file` to override with CLI.
43+
44+
### `generators`
45+
46+
- Type: `object`
47+
- Default: `{}`
48+
49+
A map of generator names to custom generators.

docs/1.guide/3.api.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Programmatic API
2+
3+
> [!NOTE]
4+
> This feature is not stable yet!
5+
6+
```js
7+
// ESM
8+
import {} from "automd";
9+
10+
// CommonJS
11+
const {} = require("automd");
12+
```

docs/1.guide/4.generators.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Generators
2+
3+
Automd uses an extendable system of generators that are responsible to maintain each `<-- automd` section.
4+
5+
There are several available generators for automd each supporting different arguments.
6+
7+
See next sections for available generators and [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!

0 commit comments

Comments
 (0)