Docs: ensure ops without examples are indexed

This commit is contained in:
Lovell Fuller 2021-05-24 16:24:04 +01:00
parent dc53f1baff
commit 35e8c8b25e
3 changed files with 11 additions and 3 deletions

File diff suppressed because one or more lines are too long

View File

@ -37,14 +37,14 @@ for (const match of matches) {
].forEach((section) => {
const contents = fs.readFileSync(path.join(__dirname, '..', `api-${section}.md`), 'utf8');
const matches = contents.matchAll(
/\n## (?<title>[A-Za-z]+)\n\n(?<firstparagraph>.+?)\n\n(?<parameters>### Parameters*.+?)#/gs
/\n## (?<title>[A-Za-z]+)\n\n(?<firstparagraph>.+?)\n\n(?<parameters>### Parameters.+?Returns)?/gs
);
for (const match of matches) {
const { title, firstparagraph, parameters } = match.groups;
const description = firstparagraph.startsWith('###')
? 'Constructor'
: extractDescription(firstparagraph);
const parameterNames = extractParameters(parameters);
const parameterNames = parameters ? extractParameters(parameters) : '';
searchIndex.push({
t: title,

View File

@ -17,6 +17,7 @@ module.exports = [
'before',
'both',
'call',
'callback',
'can',
'containing',
'default',
@ -26,6 +27,7 @@ module.exports = [
'ensure',
'etc',
'every',
'except',
'for',
'from',
'get',
@ -49,12 +51,16 @@ module.exports = [
'occur',
'occurs',
'options',
'other',
'out',
'over',
'perform',
'performs',
'provide',
'provided',
'ready',
'requires',
'returned',
'same',
'see',
'set',
@ -67,9 +73,11 @@ module.exports = [
'supported',
'sure',
'take',
'than',
'that',
'the',
'their',
'then',
'there',
'therefore',
'these',