Skip to content

Commit 6471cf1

Browse files
committed
Improve plugin docs a bit
1 parent 093dcca commit 6471cf1

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

packages/docs/scripts/generate-plugin-docs.ts

+12-7
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ for await (const dir of directories) {
6666
Array.isArray(enablers) && enablers.length > 0
6767
? [
6868
...parseFragment(
69-
"This plugin is enabled when there's a match in `dependencies` or `devDependencies` in `package.json`:"
69+
"This plugin is enabled automatically when there's a match in `dependencies` or `devDependencies` in `package.json`:"
7070
),
7171
u(
7272
'list',
@@ -77,19 +77,19 @@ for await (const dir of directories) {
7777
]
7878
: typeof enablers === 'string'
7979
? parseFragment(enablers)
80-
: [u('paragraph', [u('text', 'N/A')])];
80+
: [u('paragraph', [u('text', 'This plugin is always enabled.')])];
8181

8282
const notes = note ? [u('heading', { depth: 2 }, [u('text', 'Note')]), ...parseFragment(note)] : [];
8383

8484
const defaultConfig = hasDefaultConfig
8585
? [
8686
u('heading', { depth: 2 }, [u('text', 'Default configuration')]),
87-
...parseFragment('This configuration is added automatically if the plugin is enabled:'),
87+
...parseFragment('If enabled, this configuration is added automatically:'),
8888
u('code', {
89-
lang: 'json title="knip.json"', // TODO How to set attributes/properties/props properly?
89+
lang: 'json', // TODO How to set attributes/properties/props properly?
9090
value: JSON.stringify({ [pluginName]: defaults }, null, 2),
9191
}),
92-
...parseFragment('Your custom `config` or `entry` options override default values, they are not merged.'),
92+
...parseFragment('Custom `config` or `entry` options override default values, they are not merged.'),
9393
...parseFragment(
9494
'See [Plugins](../../explanations/plugins) for more details about plugins and their `entry` and `config` options.'
9595
),
@@ -99,16 +99,21 @@ for await (const dir of directories) {
9999
const argsText = args
100100
? [
101101
...parseFragment(
102-
`## Shell commands\n\nThis plugin adds argument parsing for the <code>${args.binaries ? args.binaries.join(' and ') : pluginName}</code> binary. Configuration:`
102+
`## Shell commands\n\nThis plugin adds argument parsing for the <code>${args.binaries ? args.binaries.join(' and ') : pluginName}</code>
103+
${args.binaries && args.binaries.length > 1 ? 'binaries' : 'binary'}. Configuration:`
103104
),
104105
...parseFragment(
105106
`\`\`\`\n${Object.entries(args)
106107
.filter(([key]) => key !== 'binaries')
107108
.map(
108-
([key, value]) => `${key}: ${typeof value === 'function' ? value.toString() : JSON.stringify(value)}`
109+
([key, value]) =>
110+
`${key}: ${typeof value === 'function' ? value.toString() : JSON.stringify(value).replace(/([,:])/g, '$1 ')}`
109111
)
110112
.join('\n')}\n\`\`\``
111113
),
114+
...parseFragment(
115+
'The configuration was generated from source code. Also see [Script Parser](../../features/script-parser).'
116+
),
112117
]
113118
: [];
114119

0 commit comments

Comments
 (0)