8000 chore(website): multiple fixes to rule docs generation (#5365) · joshhunt/typescript-eslint@78823cc · GitHub
[go: up one dir, main page]

Skip to content

Commit 78823cc

Browse files
authored
chore(website): multiple fixes to rule docs generation (typescript-eslint#5365)
* chore(website): multiple fixes to rule docs generation * add trailing period
1 parent 2588e9e commit 78823cc

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

packages/website/plugins/generated-rule-docs.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,21 @@ const generatedRuleDocs: Plugin = () => {
1818
const parent = root as unist.Parent;
1919

2020
// 1. Remove the " 🛑 This file is source code, not the primary documentation location! 🛑"
21-
parent.children.splice(3, 1);
21+
parent.children.splice(
22+
parent.children.findIndex(v => v.type === 'blockquote'),
23+
1,
24+
);
2225

2326
// 2. Add a description of the rule at the top of the file
2427
parent.children.unshift({
2528
children: [
2629
{
27-
children: [
28-
{
29-
type: 'text',
30-
value: `${docs.description}.`,
31-
},
32-
],
30+
children: docs.description
31+
.split(/`(.+?)`/)
32+
.map((value, index, array) => ({
33+
type: index % 2 === 0 ? 'text' : 'inlineCode',
34+
value: index === array.length - 1 ? `${value}.` : value,
35+
})),
3336
type: 'paragraph',
3437
},
3538
],

0 commit comments

Comments
 (0)
0