Skip to content

Commit

Permalink
chore(website): multiple fixes to rule docs generation (#5365)
Browse files Browse the repository at this point in the history
* chore(website): multiple fixes to rule docs generation

* add trailing period
  • Loading branch information
Josh-Cena committed Jul 23, 2022
1 parent 2588e9e commit 78823cc
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions packages/website/plugins/generated-rule-docs.ts
Expand Up @@ -18,18 +18,21 @@ const generatedRuleDocs: Plugin = () => {
const parent = root as unist.Parent;

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

// 2. Add a description of the rule at the top of the file
parent.children.unshift({
children: [
{
children: [
{
type: 'text',
value: `${docs.description}.`,
},
],
children: docs.description
.split(/`(.+?)`/)
.map((value, index, array) => ({
type: index % 2 === 0 ? 'text' : 'inlineCode',
value: index === array.length - 1 ? `${value}.` : value,
})),
type: 'paragraph',
},
],
Expand Down

0 comments on commit 78823cc

Please sign in to comment.