Docs: ensure parameters are indexed as they now appear in a table

This commit is contained in:
Lovell Fuller 2023-03-22 09:04:51 +00:00
parent 08d6822265
commit cd5e11bd50
3 changed files with 4 additions and 3 deletions

File diff suppressed because one or more lines are too long

View File

@ -40,7 +40,7 @@ for (const match of matches) {
].forEach((section) => { ].forEach((section) => {
const contents = fs.readFileSync(path.join(__dirname, '..', `api-${section}.md`), 'utf8'); const contents = fs.readFileSync(path.join(__dirname, '..', `api-${section}.md`), 'utf8');
const matches = contents.matchAll( const matches = contents.matchAll(
/\n## (?<title>[A-Za-z]+)\n(?<firstparagraph>.+?)\n\n(?<parameters>### Parameters.+?Returns)?/gs /## (?<title>[A-Za-z]+)\n(?<firstparagraph>.+?)\n\n.+?(?<parameters>\| Param .+?\n\n)?\*\*Example/gs
); );
for (const match of matches) { for (const match of matches) {
const { title, firstparagraph, parameters } = match.groups; const { title, firstparagraph, parameters } = match.groups;

View File

@ -16,8 +16,9 @@ const extractDescription = (str) =>
.trim(); .trim();
const extractParameters = (str) => const extractParameters = (str) =>
[...str.matchAll(/options\.(?<name>[^.`]+)/gs)] [...str.matchAll(/options\.(?<name>[^.`\] ]+)/gs)]
.map((match) => match.groups.name) .map((match) => match.groups.name)
.map((name) => name.replace(/([A-Z])/g, ' $1').toLowerCase())
.join(' '); .join(' ');
const extractKeywords = (str) => const extractKeywords = (str) =>