Skip to content

Commit 58b494e

Browse files
committed
more docs tweaks
1 parent 167ab15 commit 58b494e

File tree

4 files changed

+21
-4
lines changed

4 files changed

+21
-4
lines changed

docs/build-plugin-docs.mjs

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ custom_edit_url: null
3838
3939
# Plugin API Reference
4040
41+
v8r plugins extend the [BasePlugin](#BasePlugin) class. Validating a document yields a [ValidationResult](#ValidationResult) object.
42+
4143
`;
4244
tempFiles.forEach((file) => {
4345
if (fs.existsSync(file.filename)) {

docs/docs/configuration.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ v8r only searches for a config file in the current working directory.
2020

2121
Example yaml config file:
2222

23-
```yaml
23+
```yaml title=".v8rrc.yml"
2424
# - One or more filenames or glob patterns describing local file or files to validate
2525
# - overridden by passing one or more positional arguments
2626
patterns: ['*json']

docs/docs/plugins/using-plugins.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,12 @@ Plugins can be packages installed from a registry like [npm](https://www.npmjs.c
1010

1111
Plugins must be specified in a [config file](../configuration.md). They can't be loaded using command line arguments.
1212

13-
Plugins are run one at a time in the order they are specified in your config file.
13+
```yaml title=".v8rrc.yml"
14+
plugins:
15+
# Plugins installed from NPM (or JSR) must be prefixed by "package:"
16+
- "package:v8r-plugin-emoji-output"
17+
# Local plugins must be prefixed by "local:"
18+
- "local:./subdir/my-local-plugin.mjs"
19+
```
20+
21+
Plugins are invoked one at a time in the order they are specified in your config file.

docs/docs/plugins/writing-plugins.md

+9-2
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ These hooks may optionally return or not return a value. Each plugin is run in s
3737

3838
## Worked Example
3939

40-
Lets build a simple example plugin. Our plugin is going to register an output format called "emoji". If the user passes `--format emoji` the plugin will output a 👍 when the file is valid and a 👎 when the file is invalid instead of the default text log message.
40+
Lets build a simple example plugin. Our plugin is going to register an output format called "emoji". If the user passes `--format emoji` (or sets `format: emoji` in their config file) the plugin will output a 👍 when the file is valid and a 👎 when the file is invalid instead of the default text log message.
4141

42-
```js
42+
```js title="./plugins/v8r-plugin-emoji-output.js"
4343
// Our plugin extends the BasePlugin class
4444
import { BasePlugin } from "v8r";
4545

@@ -84,3 +84,10 @@ class EmojiOutput extends BasePlugin {
8484
// and the plugin class must be the default export
8585
export default EmojiOutput;
8686
```
87+
88+
We can now register the plugin in our config file:
89+
90+
```yaml title=".v8rrc.yml"
91+
plugins:
92+
- "local:./plugins/v8r-plugin-emoji-output.js"
93+
```

0 commit comments

Comments
 (0)